Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+32 added−0 removed
other:+32 added−0 removed
Provenance
Commit
0d22a96
Tree
49f1131
Author
sharkdp <davidpeter@web.de>
Committer
sharkdp <davidpeter@web.de>
Parent
aaf28f8
1 file changed+32 added−0 removed
added:scripts/plot_parametrized.py+32 added
1+#!/usr/bin/python2+3+"""This program shows parametrized `hyperfine` benchmark results as an4+errorbar plot."""5+6+import argparse7+import json8+import matplotlib.pyplot as plt9+10+parser = argparse.ArgumentParser(description=__doc__)11+parser.add_argument("file", help="JSON file with benchmark results", nargs="+")12+parser.add_argument("--parameter-name", metavar="name", type=str,13+ help="Name of the parameter / x-axis label")14+args = parser.parse_args()15+16+for filename in args.file:17+ with open(filename) as f:18+ results = json.load(f)["results"]19+20+ parameter_values = [float(b["parameter"]) for b in results]21+ times_mean = [b["mean"] for b in results]22+ times_stddev = [b["stddev"] for b in results]23+24+ plt.errorbar(x=parameter_values,25+ y=times_mean,26+ yerr=times_stddev,27+ capsize=2)28+29+plt.xlabel(args.parameter_name)30+plt.ylabel("Time [s]")31+plt.ylim(0, None)32+plt.show()