Add probe.Summarize to aggregate N Results into per-phase min/avg/max stats. Wire up -n/--count flag in main to repeat each URL N times and display an aligned three-column table. Single-sample output (n=1) is unchanged. URLs are grouped with a blank line between them. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2.4 KiB
2.4 KiB
Step 3 — Multiple URLs + Sampling
What this step delivers
- Multiple URLs accepted as positional arguments; each is measured in turn.
-n/--countflag repeats each URL N times and reports min / avg / max per phase instead of a single value.- With
n=1(the default) the output is identical to Step 2.
Build
cd go
go build -o latprobe .
Usage
latprobe [flags] <url> [url ...]
-n, --count int Number of requests per URL (default 1)
Examples
Default (single sample, unchanged from Step 2)
$ ./latprobe https://example.com
https://example.com (200)
DNS lookup : 13.74 ms
TCP connect : 11.20 ms
TLS handshake : 22.92 ms
Server (TTFB) : 14.88 ms
Transfer : 0.11 ms
─────────────────────────────
Total : 63.97 ms
Multiple samples (-n)
$ ./latprobe -n 5 https://example.com
https://example.com (200, 5 samples)
min avg max
DNS lookup : 1.50 ms 1.60 ms 1.70 ms
TCP connect : 10.20 ms 10.80 ms 11.50 ms
TLS handshake : 21.00 ms 22.10 ms 23.40 ms
Server (TTFB) : 12.00 ms 13.50 ms 15.20 ms
Transfer : 0.07 ms 0.09 ms 0.12 ms
─────────────────────────────────────────────────
Total : 45.00 ms 48.10 ms 52.00 ms
Multiple URLs
$ ./latprobe -n 3 https://example.com https://www.google.com
https://example.com (200, 3 samples)
min avg max
...
─────────────────────────────────────────────────
Total : ...
https://www.google.com (200, 3 samples)
min avg max
...
Notes
- DNS and connect on repeated requests: after the first request the OS DNS cache and HTTP keep-alive may eliminate those phases in subsequent samples. The spread in TCP connect and DNS between min and max shows the true variance when caches are cold.
- Partial failure: if a sample fails mid-run, that URL is skipped and the exit code is 1. Successful samples already collected are discarded for that URL.