startup: count probe calls, requested bytes and page touches on the totals line #3938
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3938"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-03T13:53:45Z.
Refs #3897. Counter half only — not the per-draw phase timers, which the issue's reporter has a draft series for.
Native draws hold the exclusive draw lock for most of their wall time and readable-memory probes take most of that hold, but the log could not say what a probe actually did: whether the ~1 fault per probe in the slow phase is a pressure page-in or a per-range guard re-arm. This makes the probe measurable.
What is counted (around
probe_readable, behaviour unchanged):bytesis not a byte count).pages_touched ≈ faultsmeans pressure page-ins whilefaults ≈ probes ≪ pagesmeans per-range guard re-arm.QueryPerformanceCounterfrom entry through the guard re-arm, gated behindX2W_PROBE_ACCOUNTING.All four print on the render totals line immediately after
reads refused before a fault, whose wording is unchanged.Why only the clock is gated. The three counters cost three interlocked operations (tens of nanoseconds) against the ~90 µs a probe can cost under pressure, and they are worthless if they default off. A
QueryPerformanceCounterpair costs roughly as much as a fast cached probe and would distort the hold it is meant to measure, so a run that wants timing opts in and every other run pays one cached bool.Tests.
startup_local_log_checkpins exact, hand-computed deltas: 16 bytes at +0x10 → (1, 16, 1); an unaligned 4-page span → (1, 0x3EDD, 3);PAGE_NOACCESSon page 2 → (1, 0x4000, 3) with 3 pages touched including the faulting one;PAGE_GUARDre-arm; a free tail refused without a touch (faults_avoided+1); 1,000 batched probes → (1000, 0x400000, 4000) with monotone ticks; 4 threads × 100 probes → exactly (400, 6400, 400); and every refused range → (0, 0, 0). A newstartup_local_log_accounting_offctest asserts the counts still advance with ticks exactly 0 when the switch is off.Verified here — Debian, clang-cl 19.1.7, xwin SDK 10.0.26100,
main7b3212a9:One case fails: the pre-existing concurrent-logging case. I checked rather than assumed — stashing this diff, rebuilding unmodified
mainand re-running the same command reproduces it identically, and it also fails in a fresh Wine prefix and under the system wine. It is a WineFILE_APPEND_DATAlimitation of that older test, not this change.Not established: Windows ctest, an MSVC build with the real
/W4 /WXflags, and — the point of the change — a title-scene run on the Windows test PC withX2W_PROBE_ACCOUNTING=1. That run is the only way to attribute the 1.3–1.65k faults per present, and no fps or hold-time number is claimed from Wine.Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-12-03T13:54:02Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
0822b71ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-03T14:19:29Z.
Review: APPROVED
Independently reviewed
0822b714. The counter increments follow probe admission and count each attempted page touch, including protected pages. QPC timing stays behind the cached opt-in, and the totals field uses atomic snapshots. Windows MSVC Debug:ctest --preset dev --no-tests=error -j 1 --output-on-failure -R '^startup_local_log($|_)'passed 10/10. Removing the page increment made 11 probe accounting assertions fail, including the four-thread case, and also failed the timing-off case. Restoring the increment made both controls pass.