MCPcopy Index your code
hub / github.com/idank/explainshell / report

Function report

tools/bench_src_index.py:122–142  ·  view source on GitHub ↗

Print and return summary stats for a list of timings.

(label: str, times: list[float])

Source from the content-addressed store, hash-verified

120
121
122def report(label: str, times: list[float]) -> dict[str, float]:
123 """Print and return summary stats for a list of timings."""
124 us = [t * 1e6 for t in times]
125 stats = {
126 "mean_us": statistics.mean(us),
127 "median_us": statistics.median(us),
128 "p95_us": sorted(us)[int(len(us) * 0.95)],
129 "p99_us": sorted(us)[int(len(us) * 0.99)],
130 "min_us": min(us),
131 "max_us": max(us),
132 }
133 print(f" {label}:")
134 print(
135 f" mean={stats['mean_us']:.1f}us "
136 f"median={stats['median_us']:.1f}us "
137 f"p95={stats['p95_us']:.1f}us "
138 f"p99={stats['p99_us']:.1f}us "
139 f"min={stats['min_us']:.1f}us "
140 f"max={stats['max_us']:.1f}us"
141 )
142 return stats
143
144
145def run_suite(

Callers 1

run_suiteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected