Last active
March 20, 2019 18:30
-
-
Save davehunt/aafa1ef1e52584d53a9cf8fc3fa95570 to your computer and use it in GitHub Desktop.
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
from pathlib import Path | |
import json | |
import statistics | |
pathlist = Path(Path.cwd()).glob("*.json") | |
for path in sorted(pathlist): | |
print(f"\n{path}") | |
print("=" * len(str(path))) | |
with open(path) as f: | |
data = json.load(f) | |
for suite in data["suites"]: | |
results = {} | |
name = suite['name'] | |
print(f"\n{name}") | |
print("-" * len(name)) | |
pageload = suite["type"] == "pageload" | |
metric = "geomean" if pageload else "score" | |
results[metric] = suite['value'] | |
if pageload: | |
for test in sorted(suite["subtests"], key=lambda x: x["name"]): | |
sample = test['replicates'][1:] | |
results[test['name']] = test['value'] | |
results[f"{test['name']}-stdev"] = statistics.stdev(sample) | |
keys = results.keys() | |
print(", ".join(keys)) | |
print(", ".join(str(results[key]) for key in keys)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment