feat(eval): added slowstart analysis

This commit is contained in:
Sebastian Rust
2026-06-03 12:44:36 +02:00
parent 4bbdda6e38
commit ce62d69f70
2 changed files with 79 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
"""Initial ssthresh per (solution, qlen) from slowstart raw text files."""
import os
from pathlib import Path
import numpy as np
def _read(path: Path) -> dict[int, np.ndarray]:
out = {}
for line in path.read_text().splitlines():
line = line.strip()
if not line:
continue
qlen, vals = line.split(":", 1)
out[int(qlen)] = np.array([float(v) for v in vals.split()])
return out
def compute(derived: Path) -> tuple[dict[str, str], list[Path]]:
raw_root = Path(os.environ.get("RAW_DATA_ROOT", derived.parent / "raw_data"))
raw = raw_root / "slowstart"
files = {"tso": raw / "tso.txt", "tso-pacing": raw / "tso_pacing.txt"}
if not all(p.exists() for p in files.values()):
return {}, []
out: dict[str, str] = {}
for sol, path in files.items():
for qlen, vals in _read(path).items():
base = f"slowstart/{sol}/qlen-{qlen}"
out[f"{base}/mean-pkts"] = f"{vals.mean():.0f}"
out[f"{base}/sd-pkts"] = f"{vals.std(ddof=1):.0f}"
out[f"{base}/n-runs"] = str(vals.size)
return out, list(files.values())