Исправить замечания ревью: останавливать лестницу только при перегрузке системы, проверять файлы серий до запуска, исправить единицы контроля шума, убрать лишние комментарии

This commit is contained in:
2026-11-04 12:58:00 +03:00
parent baa5995938
commit f5f8040783
8 changed files with 58 additions and 22 deletions
+22 -13
View File
@@ -7,9 +7,9 @@ The raw root holds <series>/<config>/rep<k>/ directories. Written to the
output directory:
summary.csv one row per step of every run;
capacity.csv the capacity of every run and the median per configuration;
control.csv the noise checks of every run: the host speed probe and the
loadgen CPU per request at the first step, flagged when more
than 25 % off the median;
control.csv the noise checks of every run, the host speed probe and the
loadgen CPU per request at the first step, each flagged when
more than 25 % off its median;
<series>-throughput.png, <series>-p99.png, capacity.png,
cpu-at-capacity.png, pool-waits.png.
Capacity is the highest step that passed the criterion loadgen applies (valid,
@@ -147,6 +147,7 @@ def main(root, out):
capacities.append({
"series": run["series"], "config": run["config"], "rep": run["rep"],
"capacity_rps": best["offered_rps"] if best else 0, "at": best,
"invalid_below": sum(1 for s in run["steps"] if not s["valid"] and (best is None or s["offered_rps"] < best["offered_rps"])),
})
with open(out / "summary.csv", "w", newline="", encoding="utf-8") as f:
@@ -160,27 +161,35 @@ def main(root, out):
configs.append((c["series"], c["config"]))
with open(out / "capacity.csv", "w", newline="", encoding="utf-8") as f:
w = csv.writer(f)
w.writerow(["series", "config", "capacity_rps_per_repeat", "capacity_rps_median"])
w.writerow(["series", "config", "capacity_rps_per_repeat", "capacity_rps_median", "invalid_steps_below_capacity"])
medians = {}
for key in configs:
values = [c["capacity_rps"] for c in capacities if (c["series"], c["config"]) == key]
mine = [c for c in capacities if (c["series"], c["config"]) == key]
values = [c["capacity_rps"] for c in mine]
medians[key] = statistics.median(values)
w.writerow([key[0], key[1], " ".join(f"{v:g}" for v in values), f"{medians[key]:g}"])
w.writerow([key[0], key[1], " ".join(f"{v:g}" for v in values), f"{medians[key]:g}",
sum(c["invalid_below"] for c in mine)])
control = []
for run in runs:
first = [r for r in rows if (r["series"], r["config"], r["rep"]) == (run["series"], run["config"], run["rep"])][:1]
if first and first[0]["cpu_loadgen_pct"] != "":
control.append([run["series"], run["config"], run["rep"], run["meta"].get("host_probe_s", ""), first[0]["offered_rps"],
round(float(first[0]["cpu_loadgen_pct"]) / first[0]["offered_rps"] * 1000, 1)])
probe = run["meta"].get("host_probe_s", "")
control.append([run["series"], run["config"], run["rep"], float(probe) if probe else None,
round(float(first[0]["cpu_loadgen_pct"]) * 10000 / first[0]["offered_rps"])])
if control:
median = statistics.median(c[5] for c in control)
probes = [c[3] for c in control if c[3] is not None]
probe_median = statistics.median(probes) if probes else None
cpu_median = statistics.median(c[4] for c in control)
with open(out / "control.csv", "w", newline="", encoding="utf-8") as f:
w = csv.writer(f)
w.writerow(["series", "config", "rep", "host_probe_s", "offered_rps", "loadgen_cpu_ms_per_1000_requests", "deviation", "flagged"])
for c in control:
deviation = c[5] / median - 1
w.writerow([*c, f"{deviation:+.2f}", abs(deviation) > CONTROL_TOLERANCE])
w.writerow(["series", "config", "rep", "host_probe_s", "probe_deviation",
"loadgen_cpu_ms_per_1000_requests", "cpu_deviation", "flagged"])
for series, config, rep, probe, cpu in control:
probe_dev = probe / probe_median - 1 if probe is not None else 0.0
cpu_dev = cpu / cpu_median - 1
w.writerow([series, config, rep, probe if probe is not None else "", f"{probe_dev:+.2f}", cpu,
f"{cpu_dev:+.2f}", max(abs(probe_dev), abs(cpu_dev)) > CONTROL_TOLERANCE])
def median_by_offered(series, config, field):
points, valid = {}, {}