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

Function pcts

tools/loadtest.py:182–200  ·  view source on GitHub ↗
(values: list[float])

Source from the content-addressed store, hash-verified

180
181
182def pcts(values: list[float]) -> dict[str, float]:
183 if not values:
184 return {}
185 s = sorted(values)
186 n = len(s)
187
188 def p(q: float) -> float:
189 i = min(n - 1, int(q * n))
190 return s[i]
191
192 return {
193 "n": n,
194 "p50": p(0.50),
195 "p90": p(0.90),
196 "p95": p(0.95),
197 "p99": p(0.99),
198 "max": s[-1],
199 "mean": statistics.mean(s),
200 }
201
202
203def _bucket_stats(

Callers 4

_bucket_statsFunction · 0.85
_build_reportFunction · 0.85
run_slowreadFunction · 0.85
run_profileFunction · 0.85

Calls 1

pFunction · 0.70

Tested by

no test coverage detected