From 8929878f1317226479a0f93cd5b38bf75ee90b2b Mon Sep 17 00:00:00 2001 From: malmert Date: Fri, 8 May 2026 21:15:22 +0200 Subject: [PATCH] progress --- tools/network_timing_benchmark.py | 39 +++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/tools/network_timing_benchmark.py b/tools/network_timing_benchmark.py index 38e0b74..9f26f11 100755 --- a/tools/network_timing_benchmark.py +++ b/tools/network_timing_benchmark.py @@ -1054,25 +1054,25 @@ def write_summary_md(summary: dict[str, Any], out_dir: Path) -> None: def run_test_suite(args: argparse.Namespace, out_dir: Path) -> list[dict[str, Any]]: tests: list[dict[str, Any]] = [] - tests.extend(run_ping_tests(args, out_dir)) + tests.extend(run_step("ping latency tests", run_ping_tests, args, out_dir)) cooldown(args.cooldown_seconds) - tests.append(run_arping(args, out_dir)) + tests.extend(run_step("ARP latency test", run_arping, args, out_dir)) cooldown(args.cooldown_seconds) - tests.append(run_iperf_tcp(args, out_dir)) + tests.extend(run_step("iperf3 TCP forward throughput test", run_iperf_tcp, args, out_dir)) cooldown(args.cooldown_seconds) - tests.append(run_iperf_tcp_reverse(args, out_dir)) + tests.extend(run_step("iperf3 TCP reverse throughput test", run_iperf_tcp_reverse, args, out_dir)) cooldown(args.cooldown_seconds) - tests.append(run_iperf_udp(args, out_dir)) + tests.extend(run_step("iperf3 UDP forward loss/jitter test", run_iperf_udp, args, out_dir)) cooldown(args.cooldown_seconds) - tests.append(run_iperf_udp_reverse(args, out_dir)) + tests.extend(run_step("iperf3 UDP reverse loss/jitter test", run_iperf_udp_reverse, args, out_dir)) cooldown(args.cooldown_seconds) - tests.extend(run_sockperf(args, out_dir)) + tests.extend(run_step("sockperf latency tests", run_sockperf, args, out_dir)) cooldown(args.cooldown_seconds) - tests.extend(run_flent(args, out_dir)) + tests.extend(run_step("flent under-load tests", run_flent, args, out_dir)) cooldown(args.cooldown_seconds) - tests.append(run_traceroute(args, out_dir)) + tests.extend(run_step("traceroute path diagnostic", run_traceroute, args, out_dir)) cooldown(args.cooldown_seconds) - tests.append(run_mtr(args, out_dir)) + tests.extend(run_step("mtr path diagnostic", run_mtr, args, out_dir)) return tests @@ -1118,9 +1118,19 @@ def parse_csv_strings(value: str) -> list[str]: def cooldown(seconds: float) -> None: if seconds <= 0: return + print(f"[progress] cooldown for {seconds:g}s", flush=True) time.sleep(seconds) +def run_step(name: str, func: Any, args: argparse.Namespace, out_dir: Path) -> list[dict[str, Any]]: + print(f"[progress] starting {name}", flush=True) + start = time.perf_counter() + result = func(args, out_dir) + duration = time.perf_counter() - start + print(f"[progress] finished {name} in {duration:.2f}s", flush=True) + return result if isinstance(result, list) else [result] + + def build_parser() -> argparse.ArgumentParser: parser = argparse.ArgumentParser( description="Measure latency, jitter, throughput, loss, CPU, and interface counters.", @@ -1223,14 +1233,23 @@ def main() -> int: out_dir = Path(args.out_dir) / f"{timestamp}-{args.label}" out_dir.mkdir(parents=True, exist_ok=True) + print(f"[progress] writing results to {out_dir}", flush=True) + print("[progress] collecting environment snapshot", flush=True) environment = collect_environment(args, out_dir) + print("[progress] finished environment snapshot", flush=True) + print("[progress] starting benchmark suite", flush=True) tests = run_test_suite(args, out_dir) + print("[progress] finished benchmark suite", flush=True) + print("[progress] writing summary files", flush=True) write_run_outputs(args, environment, tests, out_dir) + print("[progress] finished summary files", flush=True) archive_path = None if not args.no_archive: + print("[progress] creating archive", flush=True) archive_path = shutil.make_archive(str(out_dir), "gztar", root_dir=out_dir) + print("[progress] finished archive", flush=True) print(f"Wrote benchmark results to {out_dir}") print(f"Summary: {out_dir / 'summary.md'}")