Refine JSON schema and command metadata

This commit is contained in:
David Peter committed 2026-10-05 18:11:10 +02:00
1 parent c5d3a81fc5
commit 0d86e78ede
15 files changed
+59 -60

No files matched your search

+1 -1
View File
@@ -61,7 +61,7 @@ for result in results:
iqr = p75 - p25
print(f"Command '{result['command']}'")
print(f"Command '{result.get('name', result['command'])}'")
print(f" runs: {summary['count']:8d}")
print(f" mean: {summary['mean'] * unit.factor():8.3f} {unit_str}")
if summary["stddev"] is None:
+1 -1
View File
@@ -44,7 +44,7 @@ if args.benchmark_names:
for i, filename in enumerate(args.files):
with open(filename) as f:
results = json.load(f)["results"]
benchmark_commands = [b["command"] for b in results]
benchmark_commands = [b.get("name", b["command"]) for b in results]
if commands is None:
commands = benchmark_commands
else:
+1 -1
View File
@@ -66,7 +66,7 @@ with open(args.file) as f:
if args.labels:
labels = args.labels.split(",")
else:
labels = [b["command"] for b in results]
labels = [b.get("name", b["command"]) for b in results]
all_times = [
[m["time_wall_clock"]["value"] for m in b["measurements"]] for b in results
]
+2 -2
View File
@@ -52,7 +52,7 @@ with open(args.file) as f:
results = json.load(f)["results"]
for result in results:
label = result["command"]
label = result.get("name", result["command"])
times = [m["time_wall_clock"]["value"] for m in result["measurements"]]
num = len(times)
nums = range(num)
@@ -76,7 +76,7 @@ if args.title:
legend = []
for result in results:
legend.append(result["command"])
legend.append(result.get("name", result["command"]))
if not args.no_moving_average:
legend.append("moving average")
plt.legend(legend)
+1 -1
View File
@@ -37,7 +37,7 @@ with open(args.file, encoding="utf-8") as f:
if args.labels:
labels = args.labels.split(",")
else:
labels = [b["command"] for b in results]
labels = [b.get("name", b["command"]) for b in results]
times = [[m["time_wall_clock"]["value"] for m in b["measurements"]] for b in results]
if args.sort_by == "median":
+1 -1
View File
@@ -26,7 +26,7 @@ if len(results) != 2:
print("The input file has to contain exactly two benchmarks")
sys.exit(1)
a, b = (x["command"] for x in results[:2])
a, b = (x.get("name", x["command"]) for x in results[:2])
X, Y = ([m["time_wall_clock"]["value"] for m in x["measurements"]] for x in results[:2])
print(f"Command 1: {a}")