summaryrefslogtreecommitdiffstats
path: root/smt_analysis/libSMT.py
diff options
context:
space:
mode:
Diffstat (limited to 'smt_analysis/libSMT.py')
-rwxr-xr-xsmt_analysis/libSMT.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/smt_analysis/libSMT.py b/smt_analysis/libSMT.py
index cca2fce..c0b5178 100755
--- a/smt_analysis/libSMT.py
+++ b/smt_analysis/libSMT.py
@@ -38,6 +38,14 @@ def load_baseline(f):
38 max_res[s[BENCH_NAME]] = max(int(s[TOTAL_NS]), max_res[s[BENCH_NAME]]) 38 max_res[s[BENCH_NAME]] = max(int(s[TOTAL_NS]), max_res[s[BENCH_NAME]])
39 return res, samples, max_res 39 return res, samples, max_res
40 40
41# Remove the _all prefix if it exists and return the result
42# @param pair_name Name to strip (eg. pointer_all)
43# @returns Stripped name (eg. pointer)
44def strip_pair_postfix(pair_name):
45 if pair_name[-4:] == "_all":
46 return pair_name[:-4]
47 return pair_name
48
41# This parses the result data from paired, threaded timing experiements 49# This parses the result data from paired, threaded timing experiements
42# @param file1 The -A file name 50# @param file1 The -A file name
43# @param file2 The -B file name 51# @param file2 The -B file name
@@ -93,12 +101,8 @@ def load_paired(file1, file2, benchmarkCount):
93 end2 = int(lineArr2[END_S]) * 10**9 + int(lineArr2[END_N]) 101 end2 = int(lineArr2[END_S]) * 10**9 + int(lineArr2[END_N])
94 maxEnd = max(end1, end2) 102 maxEnd = max(end1, end2)
95 # Time actually co-scheduled is minEnd - maxStart, but Sims uses a different model 103 # Time actually co-scheduled is minEnd - maxStart, but Sims uses a different model
96# time[bench1][bench2][int(lineArr1[JOB_NUM])] = maxEnd - minStart
97 time[bench1][bench2][job_idx] = maxEnd - minStart 104 time[bench1][bench2][job_idx] = maxEnd - minStart
98 if lineArr1[SECOND_PROG] == "h264_dec" and lineArr2[JOB_NUM] == 0:
99 print(maxEnd - minStart)
100 # Compute offset: if first job starts at t=0, when does second start? 105 # Compute offset: if first job starts at t=0, when does second start?
101# offset[bench1][bench2][int(lineArr1[JOB_NUM])] = abs(start2-start1)
102 offset[bench1][bench2][job_idx] = abs(start2-start1) 106 offset[bench1][bench2][job_idx] = abs(start2-start1)
103 # Compute some running statistics 107 # Compute some running statistics
104 avg_off += abs(start2-start1) 108 avg_off += abs(start2-start1)
@@ -110,14 +114,14 @@ def load_paired(file1, file2, benchmarkCount):
110 bench2 = bench2 + 1 114 bench2 = bench2 + 1
111 job_idx = 0 115 job_idx = 0
112 else: 116 else:
113 name_to_idx[lineArr1[FIRST_PROG]] = bench1 117 name_to_idx[strip_pair_postfix(lineArr1[FIRST_PROG])] = bench1
114 idx_to_name[bench1] = lineArr1[FIRST_PROG] 118 idx_to_name[bench1] = strip_pair_postfix(lineArr1[FIRST_PROG])
115 bench1 = bench1 + 1 119 bench1 = bench1 + 1
116 bench2 = bench1 # bench1 will never again appear as bench2 120 bench2 = bench1 # bench1 will never again appear as bench2
117 job_idx = 0 121 job_idx = 0
118 else: 122 else:
119 job_idx += 1 123 job_idx += 1
120 print("Average offset is: " + str(avg_off/avg_off_samp) + "ns") 124 print("Average offset is: {:.2f} nanoseconds".format(avg_off/avg_off_samp))
121 return time, offset, name_to_idx, idx_to_name 125 return time, offset, name_to_idx, idx_to_name
122 126
123# Paired times use an abuse of the baseline file format 127# Paired times use an abuse of the baseline file format