Format load test script
Browse files- scripts/load_test.py +10 -5
scripts/load_test.py
CHANGED
|
@@ -465,7 +465,9 @@ def _run_phase_sync(
|
|
| 465 |
)
|
| 466 |
|
| 467 |
if resp.status_code != 200:
|
| 468 |
-
print(
|
|
|
|
|
|
|
| 469 |
except Exception as exc:
|
| 470 |
print(f" [{phase} {i + 1}] Exception: {exc}")
|
| 471 |
samples.append(
|
|
@@ -656,12 +658,13 @@ def _print_latency_block(label: str, stats: dict[str, Any] | None) -> None:
|
|
| 656 |
f"p50={stats['p50']:.1f}ms p95={stats['p95']:.1f}ms p99={stats['p99']:.1f}ms"
|
| 657 |
)
|
| 658 |
print(
|
| 659 |
-
" "
|
| 660 |
-
f"min={stats['min']:.1f} max={stats['max']:.1f} mean={stats['mean']:.1f}"
|
| 661 |
)
|
| 662 |
|
| 663 |
|
| 664 |
-
def print_results(
|
|
|
|
|
|
|
| 665 |
"""Print formatted load-test results."""
|
| 666 |
print("\n" + "=" * 50)
|
| 667 |
print("LOAD TEST RESULTS")
|
|
@@ -701,7 +704,9 @@ def print_results(results: dict[str, Any], target_ms: float = DEFAULT_TARGET_MS)
|
|
| 701 |
print("\nLatency drill-down (measured phase):")
|
| 702 |
_print_latency_block("Client RTT", measured.get("client_latency_ms"))
|
| 703 |
_print_latency_block("Server time", measured.get("server_latency_ms"))
|
| 704 |
-
_print_latency_block(
|
|
|
|
|
|
|
| 705 |
|
| 706 |
if warmup:
|
| 707 |
warmup_client = (warmup.get("client_latency_ms") or {}).get("p95")
|
|
|
|
| 465 |
)
|
| 466 |
|
| 467 |
if resp.status_code != 200:
|
| 468 |
+
print(
|
| 469 |
+
f" [{phase} {i + 1}] Error: {resp.status_code} - {resp.text[:100]}"
|
| 470 |
+
)
|
| 471 |
except Exception as exc:
|
| 472 |
print(f" [{phase} {i + 1}] Exception: {exc}")
|
| 473 |
samples.append(
|
|
|
|
| 658 |
f"p50={stats['p50']:.1f}ms p95={stats['p95']:.1f}ms p99={stats['p99']:.1f}ms"
|
| 659 |
)
|
| 660 |
print(
|
| 661 |
+
f" min={stats['min']:.1f} max={stats['max']:.1f} mean={stats['mean']:.1f}"
|
|
|
|
| 662 |
)
|
| 663 |
|
| 664 |
|
| 665 |
+
def print_results(
|
| 666 |
+
results: dict[str, Any], target_ms: float = DEFAULT_TARGET_MS
|
| 667 |
+
) -> None:
|
| 668 |
"""Print formatted load-test results."""
|
| 669 |
print("\n" + "=" * 50)
|
| 670 |
print("LOAD TEST RESULTS")
|
|
|
|
| 704 |
print("\nLatency drill-down (measured phase):")
|
| 705 |
_print_latency_block("Client RTT", measured.get("client_latency_ms"))
|
| 706 |
_print_latency_block("Server time", measured.get("server_latency_ms"))
|
| 707 |
+
_print_latency_block(
|
| 708 |
+
"Network/platform overhead", measured.get("network_overhead_ms")
|
| 709 |
+
)
|
| 710 |
|
| 711 |
if warmup:
|
| 712 |
warmup_client = (warmup.get("client_latency_ms") or {}).get("p95")
|