progress
This commit is contained in:
@@ -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]]:
|
def run_test_suite(args: argparse.Namespace, out_dir: Path) -> list[dict[str, Any]]:
|
||||||
tests: 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)
|
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)
|
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)
|
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)
|
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)
|
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)
|
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)
|
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)
|
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)
|
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
|
return tests
|
||||||
|
|
||||||
|
|
||||||
@@ -1118,9 +1118,19 @@ def parse_csv_strings(value: str) -> list[str]:
|
|||||||
def cooldown(seconds: float) -> None:
|
def cooldown(seconds: float) -> None:
|
||||||
if seconds <= 0:
|
if seconds <= 0:
|
||||||
return
|
return
|
||||||
|
print(f"[progress] cooldown for {seconds:g}s", flush=True)
|
||||||
time.sleep(seconds)
|
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:
|
def build_parser() -> argparse.ArgumentParser:
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description="Measure latency, jitter, throughput, loss, CPU, and interface counters.",
|
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 = Path(args.out_dir) / f"{timestamp}-{args.label}"
|
||||||
out_dir.mkdir(parents=True, exist_ok=True)
|
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)
|
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)
|
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)
|
write_run_outputs(args, environment, tests, out_dir)
|
||||||
|
print("[progress] finished summary files", flush=True)
|
||||||
|
|
||||||
archive_path = None
|
archive_path = None
|
||||||
if not args.no_archive:
|
if not args.no_archive:
|
||||||
|
print("[progress] creating archive", flush=True)
|
||||||
archive_path = shutil.make_archive(str(out_dir), "gztar", root_dir=out_dir)
|
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"Wrote benchmark results to {out_dir}")
|
||||||
print(f"Summary: {out_dir / 'summary.md'}")
|
print(f"Summary: {out_dir / 'summary.md'}")
|
||||||
|
|||||||
Reference in New Issue
Block a user