diff --git a/newAnalyzeMicroScalePart2.py b/newAnalyzeMicroScalePart2.py new file mode 100755 index 0000000000..b907f4e013 --- /dev/null +++ b/newAnalyzeMicroScalePart2.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 + +import math +import sys +import csv +import os +from urllib.parse import urlparse +import simplejson as json + +def getMedian(els, group, image): + for el in els: + if group in el["Group"] and image in el["Group"]: + return float(el["Median"].replace(',', '')) + sys.exit("Unreachable") + +def getScale(el): + group = el["Group"] + u = urlparse(group) + totalStr = u.netloc.split('.', 1)[0] + total = totalStr.split("total", 1)[1] + return int(total) + +def computeSummary(summaryFile, parsed1, parsed2, parsed3): + scales_dups = [getScale(el) for el in parsed1] + scales = list(set(scales_dups)) + scales.sort() + with open(summaryFile, "w") as f: + writer = csv.writer(f) + for scale in scales: + row = [ scale ] + group = "total" + str(scale) + for image in ["_large.jpeg", "_small.jpeg"]: + stock_val = getMedian(parsed1, group, image) + nacl_val = getMedian(parsed2, group, image) + ps_val = getMedian(parsed3, group, image) + row.append(nacl_val/stock_val) + row.append(ps_val/stock_val) + writer.writerow(row) + +def read(folder, filename): + inputFileName1 = os.path.join(folder, filename) + with open(inputFileName1) as f: + input1 = f.read() + return input1 + +def main(): + if len(sys.argv) < 2: + print("Expected " + sys.argv[0] + " inputFolderName") + exit(1) + inputFolderName = sys.argv[1] + + input1 = read(inputFolderName, "static_stock_terminal_analysis.json") + input2 = read(inputFolderName, "new_nacl_cpp_terminal_analysis.json") + input3 = read(inputFolderName, "new_ps_cpp_terminal_analysis.json") + + parsed1 = json.loads(input1)["data"] + parsed2 = json.loads(input2)["data"] + parsed3 = json.loads(input3)["data"] + + computeSummary(os.path.join(inputFolderName, "sandbox_scaling.dat"), parsed1, parsed2, parsed3) + +main() diff --git a/newAnalyzePerf.py b/newAnalyzePerf.py index ab2f5c67bc..b41f22a852 100755 --- a/newAnalyzePerf.py +++ b/newAnalyzePerf.py @@ -23,6 +23,8 @@ def handle_line(line, s, skipFirstHost): if skipFirstHost: group = group.split('(')[1].split(')')[0] u = urlparse(group) + if u.scheme == "data": + return s u = u._replace(netloc=u.netloc.split('.', 1)[1]) group = u.geturl() index = fragment.split(',')[1] diff --git a/newRunMicroImageScaleTest b/newRunMicroImageScaleTest index b2ca282e41..4f49ecc817 100755 --- a/newRunMicroImageScaleTest +++ b/newRunMicroImageScaleTest @@ -93,6 +93,7 @@ for (( j = 0; j < ${#FFVersions[@]}; j++ )); do done for (( j = 0; j < ${#FFVersions[@]}; j++ )); do - ./newAnalyzePerf.py "${OUTPUTPATH}/${FFVersions[$j]}${FFVersionsSuffix[$j]}_terminal_output.txt" 2>&1 >> "${OUTPUTPATH}/${FFVersions[$j]}${FFVersionsSuffix[$j]}_terminal_analysis.json" True + ./newAnalyzePerf.py "${OUTPUTPATH}/${FFVersions[$j]}${FFVersionsSuffix[$j]}_terminal_output.txt" True 2>&1 >> "${OUTPUTPATH}/${FFVersions[$j]}${FFVersionsSuffix[$j]}_terminal_analysis.json" done +newAnalyzeMicroScalePart2.py "${OUTPUTPATH}/" \ No newline at end of file