`scripts/browser-probe/` (measurement only; no device or backend behavior
changes).
The frame-pacing arm of `gpu-probe.html` reported a mean fps and a single
worst-frame figure. Neither can answer the question the probe exists for.
"120 fps, perfectly even" and "120 fps with occasional stalls" produce the
same mean, and one 40 ms stall and forty of them produce the same worst
frame. The one measured number carried forward from this rig — Safari at
119.4 fps, worst frame 13 ms — is consistent with both a healthy display and
a stuttering one, so it could not settle anything.
The loop now keeps every frame delta and summarises the distribution:
median/p95/p99, a long-frame count and percentage, dropped refreshes, the
worst consecutive run of long frames, and a histogram bucketed in refresh
intervals. The run of long frames is reported separately from their count
because only a run is visible as a jerk; ten scattered drops and one
ten-frame freeze are the same number and not the same defect.
Two choices worth stating. The refresh interval is the *median* observed
delta, not a hardcoded 1/120: this guest display has run at 60 and at 120,
and a fixed budget misreports every frame on the other one. The median
rather than the mean because it is the estimator a burst of long frames
cannot drag with it. A frame counts as long past 1.5 intervals, the midpoint
between one interval and two, which is where a delta stops being jitter
around the budget and becomes a skipped vblank.
The statistics moved into a DOM-free `summarizeDeltas` so they can be tested.
`PROBE_SECONDS` widens the window through `web-gpu-probe.sh` (the settle wait
scales with it, or a slow browser is read before it posts and scored silent);
5 s establishes a mean but can miss a stall that happens twice a minute.
Tests: `node scripts/browser-probe/pacing-stats-test.mjs` — 20 checks, all
passing. It slices the functions out of the page rather than restating them,
so it exercises shipped code and not a copy that can drift. Mutation-verified
by replacing the median with a hardcoded 120 Hz budget: 5 checks fail, and a
healthy 60 Hz stream is then scored as dropping all 300 frames, which is the
specific lie the median exists to prevent.
Not verified: no live guest run yet — this commit changes the instrument, not
the thing measured. Requires `node` for the test only; the probe page itself
runs in the guest browser as before.
Co-Authored-By: Claude <noreply@anthropic.com>