From 4a9dbe4680010e659589c21e90ba251f7e57705b Mon Sep 17 00:00:00 2001 From: Ross Thompson Date: Wed, 22 Feb 2023 16:11:52 -0600 Subject: [PATCH] Updated branch predictor results processing script. --- bin/parseHPMC.py | 44 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/bin/parseHPMC.py b/bin/parseHPMC.py index 0cc75e10..ddf0ccb7 100755 --- a/bin/parseHPMC.py +++ b/bin/parseHPMC.py @@ -124,8 +124,9 @@ def ProcessFile(fileName): benchmarks.append((testName, opt, HPMClist)) return benchmarks -def ComputeAverage(benchmarks): +def ComputeArithmeticAverage(benchmarks): average = {} + index = 0 for (testName, opt, HPMClist) in benchmarks: for field in HPMClist: value = HPMClist[field] @@ -133,17 +134,40 @@ def ComputeAverage(benchmarks): average[field] = value else: average[field] += value + index += 1 benchmarks.append(('All', '', average)) def FormatToPlot(currBenchmark): names = [] values = [] for config in currBenchmark: - print ('config' , config) + #print ('config' , config) names.append(config[0]) values.append(config[1]) return (names, values) +def GeometricAverage(benchmarks, field): + Product = 1 + index = 0 + for (testName, opt, HPMCList) in benchmarks: + #print(HPMCList) + Product *= HPMCList[field] + index += 1 + return Product ** (1.0/index) + +def ComputeGeometricAverage(benchmarks): + fields = ['BDMR', 'BTMR', 'RASMPR', 'ClassMPR', 'ICacheMR', 'DCacheMR'] + AllAve = {} + for field in fields: + Product = 1 + index = 0 + for (testName, opt, HPMCList) in benchmarks: + #print(HPMCList) + Product *= HPMCList[field] + index += 1 + AllAve[field] = Product ** (1.0/index) + benchmarks.append(('All', '', AllAve)) + if(sys.argv[1] == '-b'): configList = [] summery = 0 @@ -152,22 +176,24 @@ if(sys.argv[1] == '-b'): sys.argv = sys.argv[1::] for config in sys.argv[2::]: benchmarks = ProcessFile(config) - ComputeAverage(benchmarks) + #ComputeArithmeticAverage(benchmarks) ComputeAll(benchmarks) + ComputeGeometricAverage(benchmarks) + print('CONFIG: %s GEO MEAN: %f' % (config, GeometricAverage(benchmarks, 'BDMR'))) configList.append((config.split('.')[0], benchmarks)) # Merge all configruations into a single list benchmarkAll = [] for (config, benchmarks) in configList: - print(config) + #print(config) for benchmark in benchmarks: (nameString, opt, dataDict) = benchmark - print("BENCHMARK") - print(nameString) - print(opt) - print(dataDict) + #print("BENCHMARK") + #print(nameString) + #print(opt) + #print(dataDict) benchmarkAll.append((nameString, opt, config, dataDict)) - print('ALL!!!!!!!!!!') + #print('ALL!!!!!!!!!!') #for bench in benchmarkAll: # print('BENCHMARK') # print(bench)