This repository has been archived by the owner on Nov 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
703 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import sys | ||
import simplejson as json | ||
from statistics import mean, median, stdev | ||
|
||
def read(folder, filename): | ||
inputFileName1 = os.path.join(folder, filename) | ||
with open(inputFileName1) as f: | ||
input1 = f.read() | ||
return input1 | ||
|
||
def readJson(folder, filename): | ||
data = read(folder, filename) | ||
return json.loads(data) | ||
|
||
def readJsonTestValue(folder, filename): | ||
input = readJson(folder, filename) | ||
ret = input["suites"][0]["subtests"][0]["value"] | ||
return ret | ||
|
||
def writeJson(folder, filename, obj): | ||
str = json.dumps(obj, indent=4) | ||
full_file = os.path.join(folder, filename) | ||
with open(full_file, "w") as text_file: | ||
text_file.write("%s\n" % str) | ||
|
||
def writeMetrics(fileobj, label, arr): | ||
fileobj.write("Mean {}: {}\n".format(label, mean(arr))) | ||
fileobj.write("Median {}: {}\n".format(label, median(arr))) | ||
fileobj.write("Std_Dev {}: {}\n".format(label, stdev(arr))) | ||
|
||
def main(): | ||
if len(sys.argv) < 2: | ||
print("Expected " + sys.argv[0] + " inputFolderName") | ||
exit(1) | ||
inputFolderName = sys.argv[1] | ||
|
||
builds = { | ||
"stock" : "static_stock_external_page_render{}", | ||
"sfi" : "new_nacl_cpp_external_page_render{}", | ||
"psspin" : "new_ps_cpp_external_page_render{}" | ||
} | ||
|
||
other_builds = [build for build in builds.keys()] | ||
other_builds.remove("stock") | ||
|
||
sites = [ | ||
"google.com", | ||
"yelp.com", | ||
"eurosport.com", | ||
"legacy.com", | ||
"reddit.com", | ||
"seatguru.com", | ||
"twitch.tv", | ||
"amazon.com", | ||
"economist.com", | ||
"espn.com", | ||
"wowprogress.com" | ||
] | ||
|
||
latency_output = {} | ||
for build, build_output in builds.items(): | ||
latency_output[build] = [] | ||
for i in range(1, len(sites)): | ||
siteobj = { | ||
"name" : sites[i], | ||
"value" : readJsonTestValue(inputFolderName, build_output.format(str(i) + ".json")) | ||
} | ||
latency_output[build].append(siteobj) | ||
|
||
writeJson(inputFolderName, "page_latency.json", latency_output) | ||
|
||
with open(os.path.join(inputFolderName, "page_latency_metrics.txt"), "w") as text_file: | ||
for build in other_builds: | ||
overheads = [] | ||
for i in range(1, len(sites)): | ||
stock_val = readJsonTestValue(inputFolderName, builds["stock"].format(str(i) + ".json")) | ||
build_val = readJsonTestValue(inputFolderName, builds[build].format(str(i) + ".json")) | ||
overhead = 100.0 * ((build_val/stock_val) - 1.0) | ||
overheads.append(overhead) | ||
writeMetrics(text_file, "{} latency".format(build), overheads) | ||
|
||
memory_output = {} | ||
for build, build_output in builds.items(): | ||
memory_output[build] = [] | ||
for i in range(1, len(sites)): | ||
siteobj = { | ||
"name" : sites[i], | ||
"value" : int(read(inputFolderName, build_output.format(str(i) + "_mem.txt"))) | ||
} | ||
memory_output[build].append(siteobj) | ||
|
||
writeJson(inputFolderName, "page_memory_overhead.json", memory_output) | ||
|
||
with open(os.path.join(inputFolderName, "page_memory_overhead_metrics.txt"), "w") as text_file: | ||
for build in other_builds: | ||
overheads = [] | ||
for i in range(1, len(sites)): | ||
stock_val = int(read(inputFolderName, builds["stock"].format(str(i) + "_mem.txt"))) | ||
build_val = int(read(inputFolderName, builds[build].format(str(i) + "_mem.txt"))) | ||
overhead = 100.0 * ((build_val/stock_val) - 1.0) | ||
overheads.append(overhead) | ||
writeMetrics(text_file, "{} memory overhead".format(build), overheads) | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/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): | ||
for el in els: | ||
if group in el["Group"]: | ||
return float(el["Median"].replace(',', '')) | ||
sys.exit("Unreachable") | ||
|
||
def computeSummary(summaryFile, ext, parsed1, parsed2, parsed3): | ||
with open(summaryFile, "w") as f: | ||
writer = csv.writer(f) | ||
writer.writerow(["Image", "SFI sandbox", "Process sandbox"]) | ||
for qual in ["best", "default", "none"]: | ||
for res, label in {"1920" : "\\n1280p", "480" : "{0}\\n320p", "240" : "\\n135p"}.items(): | ||
group_suffix = qual + "_" + res + "." + ext | ||
stock_val = getMedian(parsed1, group_suffix) | ||
nacl_val = getMedian(parsed2, group_suffix) | ||
ps_val = getMedian(parsed3, group_suffix) | ||
writer.writerow([ label.replace("{0}", qual), nacl_val/stock_val, ps_val/stock_val ]) | ||
|
||
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, "jpeg_perf.dat"), "jpeg", parsed1, parsed2, parsed3) | ||
computeSummary(os.path.join(inputFolderName, "png_perf.dat") , "png" , parsed1, parsed2, parsed3) | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.