| 96 | |
| 97 | |
| 98 | def summarize(runs: list[BenchRun]) -> pd.DataFrame: |
| 99 | rows = [] |
| 100 | for run in runs: |
| 101 | s = ( |
| 102 | pd.DataFrame(run.stats) |
| 103 | if run.stats |
| 104 | else pd.DataFrame({"running": [], "waiting": [], "kv_cache_pct": []}) |
| 105 | ) |
| 106 | rows.append( |
| 107 | { |
| 108 | "concurrency": run.max_concurrency, |
| 109 | "run": run.run_number, |
| 110 | "n_logs": len(s), |
| 111 | "kv_mean": s["kv_cache_pct"].mean() if len(s) else 0, |
| 112 | "kv_max": s["kv_cache_pct"].max() if len(s) else 0, |
| 113 | "running_mean": s["running"].mean() if len(s) else 0, |
| 114 | "running_max": s["running"].max() if len(s) else 0, |
| 115 | "waiting_mean": s["waiting"].mean() if len(s) else 0, |
| 116 | "waiting_max": s["waiting"].max() if len(s) else 0, |
| 117 | } |
| 118 | ) |
| 119 | return pd.DataFrame(rows) |
| 120 | |
| 121 | |
| 122 | def main(): |