Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HmvoHH3ZnCEaPNXRpDxDZe
34 lines
1.3 KiB
Python
Executable File
34 lines
1.3 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Median across repetitions, one row per configuration. usage: summarize.py output/02-runs.txt"""
|
|
import re
|
|
import statistics
|
|
import sys
|
|
from collections import OrderedDict
|
|
|
|
rows = OrderedDict()
|
|
for line in open(sys.argv[1]):
|
|
if "FAILED" in line or not line.strip():
|
|
continue
|
|
kv = dict(re.findall(r"(\w+)=([^\s]+)", line))
|
|
rows.setdefault(kv["label"], []).append({k: float(v) for k, v in kv.items() if k not in ("label",)})
|
|
|
|
cols = [
|
|
("p50 ms", "p50_ms", "{:.2f}"),
|
|
("p99 ms", "p99_ms", "{:.1f}"),
|
|
("p99.9 ms", "p999_ms", "{:.1f}"),
|
|
("max ms", "max_ms", "{:.1f}"),
|
|
("peak req/s", "peak_rps", "{:.0f}"),
|
|
("pauses", "pauses", "{:.0f}"),
|
|
("pause p99 ms", "pause_p99_ms", "{:.3f}"),
|
|
("pause max ms", "pause_max_ms", "{:.3f}"),
|
|
("pause total ms", "pause_total_ms", "{:.0f}"),
|
|
("RSS MB", "rss_peak_mb", "{:.0f}"),
|
|
]
|
|
reps = max(len(v) for v in rows.values())
|
|
print(f"median of {reps} runs per configuration (latency from a fixed-rate open loop; throughput from a closed loop)")
|
|
print()
|
|
print(f"{'configuration':<26}" + "".join(f"{c[0]:>15}" for c in cols))
|
|
for label, runs in rows.items():
|
|
cells = [c[2].format(statistics.median(r[c[1]] for r in runs)) for c in cols]
|
|
print(f"{label:<26}" + "".join(f"{x:>15}" for x in cells))
|