Take a census walk seen running for over 2 s as a torn read and charge nothing to it.

The review of c05e6528 found a window in perf.c ft_frame: it loads walk_t0 and then walk_t1, while perf_census_walk(1)
stores walk_t1 = 0 and then the new start. A walk that starts between the two loads leaves ft_frame with the previous
walk's start and an end of 0, so perf_census.h census_charge took that walk as running since then, the whole frame as
overlapped, and moved all its replay and unattributed time to "census". The window is a few nanoseconds, but the error
is a whole frame. A walk takes 100-260 ms, so census_charge now returns 0 for a walk seen running for longer than
CENSUS_WALK_MAX_NS (2 s).

tests/census_charge_check.c gets a torn read (a start 10 s back with an end of 0), a walk running for 1.9 s, which still
counts, and one running for 2.001 s, which does not; its random frames now reach walks more than 2 s old and check the
moved time exactly (the overlap capped by the frame's room and its replay and unattributed parts) instead of only its
bound. Built against the header before this change, the check fails the torn read, the 2.001 s walk and the first such
random frame; with it, it passes. docs/building.md names the new case.

Diagnostics only: the census part exists only with NX2NAVI_MEM_CENSUS = 1. Not reproduced in a run (the window is a
few nanoseconds). perf.c compiles with the dev flags and adds no -Wall -Wextra warnings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-13 17:50:59 -05:00
parent b7c678540e
commit 28f420bf03
3 changed files with 29 additions and 9 deletions

View File

@@ -723,9 +723,9 @@ and that the lines of older logs, without those fields, still parse. Any Python,
A change to what the frame-time summary charges to an address-space walk of `NX2NAVI_MEM_CENSUS`
(`runtime/perf_census.h` `census_charge`, `runtime/perf.c` `ft_frame`) passes `python tests\census_charge_check.py`,
which builds the header alone: a walk before, after or around a frame, one still running, the charge taken from the
replay part first, capped by the overlap and the parts, and 100,000 random frames in which the census part never passes
the frame and the parts keep their sum. No GPU, no game files.
which builds the header alone: a walk before, after or around a frame, one still running, a torn read of the last walk's
start (taken as no walk), the charge taken from the replay part first, capped by the overlap and the parts, and 100,000
random frames in which the census part never passes the frame and the parts keep their sum. No GPU, no game files.
A change to how the on/off switches read their value (`runtime/perf.c` `rt_knob`) passes `python tests\rt_knob_check.py`,
which cuts the function out of the file with its warning table and builds it with stand-ins for the settings and the