Skip to content

Instantly share code, notes, and snippets.

@davehunt
Last active March 20, 2019 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davehunt/aafa1ef1e52584d53a9cf8fc3fa95570 to your computer and use it in GitHub Desktop.
Save davehunt/aafa1ef1e52584d53a9cf8fc3fa95570 to your computer and use it in GitHub Desktop.
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