From bb76227aaea6ba99b3512ffbd228e699c87beb9e Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Tue, 9 Mar 2021 19:08:58 -0500 Subject: Analysis Scripts: Cleanup computeSMTslowdown.py and libSMT.py - Don't print superfluous data - Remove some commented-out code - Print summary statistics in a format more similar to that used in the paper - Automatically strip the `_all` postfix from the paired benchmarks --- smt_analysis/libSMT.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'smt_analysis/libSMT.py') 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): max_res[s[BENCH_NAME]] = max(int(s[TOTAL_NS]), max_res[s[BENCH_NAME]]) return res, samples, max_res +# Remove the _all prefix if it exists and return the result +# @param pair_name Name to strip (eg. pointer_all) +# @returns Stripped name (eg. pointer) +def strip_pair_postfix(pair_name): + if pair_name[-4:] == "_all": + return pair_name[:-4] + return pair_name + # This parses the result data from paired, threaded timing experiements # @param file1 The -A file name # @param file2 The -B file name @@ -93,12 +101,8 @@ def load_paired(file1, file2, benchmarkCount): end2 = int(lineArr2[END_S]) * 10**9 + int(lineArr2[END_N]) maxEnd = max(end1, end2) # Time actually co-scheduled is minEnd - maxStart, but Sims uses a different model -# time[bench1][bench2][int(lineArr1[JOB_NUM])] = maxEnd - minStart time[bench1][bench2][job_idx] = maxEnd - minStart - if lineArr1[SECOND_PROG] == "h264_dec" and lineArr2[JOB_NUM] == 0: - print(maxEnd - minStart) # Compute offset: if first job starts at t=0, when does second start? -# offset[bench1][bench2][int(lineArr1[JOB_NUM])] = abs(start2-start1) offset[bench1][bench2][job_idx] = abs(start2-start1) # Compute some running statistics avg_off += abs(start2-start1) @@ -110,14 +114,14 @@ def load_paired(file1, file2, benchmarkCount): bench2 = bench2 + 1 job_idx = 0 else: - name_to_idx[lineArr1[FIRST_PROG]] = bench1 - idx_to_name[bench1] = lineArr1[FIRST_PROG] + name_to_idx[strip_pair_postfix(lineArr1[FIRST_PROG])] = bench1 + idx_to_name[bench1] = strip_pair_postfix(lineArr1[FIRST_PROG]) bench1 = bench1 + 1 bench2 = bench1 # bench1 will never again appear as bench2 job_idx = 0 else: job_idx += 1 - print("Average offset is: " + str(avg_off/avg_off_samp) + "ns") + print("Average offset is: {:.2f} nanoseconds".format(avg_off/avg_off_samp)) return time, offset, name_to_idx, idx_to_name # Paired times use an abuse of the baseline file format -- cgit v1.2.2