You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The +15% inlining win shipped in the previous commit didn't fix the
real-world AvP audio stutter, because audio dropouts are governed
by *worst-case* frame time, not average. This commit lands the
diagnostic infrastructure that found the actual cost driver.
* test_benchmark now records per-frame timing and reports
p50 / p99 / p999 / max ms-per-frame plus the count of frames
that blew the 16.67 ms (60 Hz) budget.
* perf_counters.h gains `perf_counters_find(name)` so the harness
can snapshot a counter before/after each retro_run() call and
report per-frame deltas.
* test_benchmark uses the new lookup to print the slowest frames
along with their blitter call count and inner-iteration count,
and the slow-vs-avg ratio.
* Makefile gains BLITTER_TRACE=1 toggle that wires
-DBLITTER_TRACE; src/tom/blitter.c grows a per-blit elapsed-ms
dump that fires for any single BlitterMidsummer2 call exceeding
a threshold, so we can tell whether worst-case frame spikes are
one giant blit or many small ones.
What this revealed for AvP gameplay (state7, accurate blitter,
1200 frames after 120 warmup, M-series host):
avg 5.1 ms, p99 17.0 ms, p999 18.2 ms, max 18.4 ms
25 / 1200 frames over 16.67 ms (2%)
Avg per frame: 403 blits, 49,774 inner iters
Slow per frame: 2009 blits, 247,508 inner iters (5x)
The slow frames are perfectly periodic and consistent (5x the work
on every spike, every spike same exact count). No single blit is
slow -- the BLITTER_TRACE dump prints zero lines even at a 0.3 ms
threshold. AvP is just doing 5x more blitter work on roughly
every 24th frame. That's the audio dropout root cause: the inlining
helped average throughput but the periodic 5x spikes still blow
the budget.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
0 commit comments