total_num = 0 # for debug
for dir in os.listdir (target_dir):
  if dir == ".DS_Store":
    continue
  num_sim_file = 0 # number of workloads get simulated in each folder
  _ws_per_workload = [0] * NUM_WORKLOAD
  _hs_per_workload = [0] * NUM_WORKLOAD
  _uf_per_workload = [0] * NUM_WORKLOAD
  for sim_index in range (1, NUM_WORKLOAD+1, 1):
    sim_file = target_dir + dir + "/sim_" + str(sim_index) + ".out"
    if os.path.isfile (sim_file) is False:
      print "The file " + sim_file + " doesn't exist."
      continue

    # read in the referenced IPC
    ipc_alone = get.get_ipc_alone (workload_dir, sim_index)
    stat_share_design = get.get_stat (sim_file)
    ipc_share_design = get.get_ipc_share (stat_share_design)
    (ws_design, hs_design, uf_design) = get.cmp_metric (ipc_alone, ipc_share_design)
    _ws_per_workload [num_sim_file] = ws_design
    _hs_per_workload [num_sim_file] = hs_design
    _uf_per_workload [num_sim_file] = uf_design

    num_sim_file = num_sim_file + 1
    total_num = total_num + 1
  ws_plt = ws_plt + [get.cmp_geo_avg (_ws_per_workload)]
  hs_plt = hs_plt + [get.cmp_geo_avg (_hs_per_workload)]
  uf_plt = uf_plt + [get.cmp_geo_avg (_uf_per_workload)]
  para_value_plt = para_value_plt + [dir]
  num_value = num_value + 1 # increase the number of value being swept
Example #2
0
#NUM_SIM = 30 

ws_norm = 0
hs_norm = 0
uf_norm = 0
ws_norm_raw = []
hs_norm_raw = []
uf_norm_raw = []
max_ws = 0
max_hs = 0
min_uf = 100
l1miss_aggr = 0
num_sim = 0

for index in range (1, NUM_SIM+1):
  ipc_alone = get.get_ipc_alone (PATH_WORKLOAD, index)
  design_file = PATH_DESIGN + "sim_" + str(index) + ".out"
  baseline_file = PATH_BASELINE + "sim_" + str(index) + ".out"
  if os.path.isfile (design_file) is False or os.path.isfile (baseline_file) is False:
    print "The file doesn't exist."
    continue
  stat_share_design = get.get_stat (design_file)
  stat_share_baseline = get.get_stat (baseline_file)
  ipc_share_design = get.get_ipc_share (stat_share_design)
  ipc_share_baseline = get.get_ipc_share (stat_share_baseline)
  # normalized to the baseline design
  (ws_design, hs_design, uf_design, uf_baseline) = get.cmp_metric_bs (ipc_alone, ipc_share_baseline, ipc_share_design)
  ws_norm = ws_norm + ws_design/NODE
  hs_norm = hs_norm + hs_design
  uf_norm = uf_norm + float(uf_design)/uf_baseline
  ws_norm_raw = ws_norm_raw + [ws_design/NODE]