Walk the process's address space for the memory census only when mem_census asks for it.

With trace = perf, every 600 frames heap_log started a thread that walks the whole address space with VirtualQuery
(plat_mem_census) for the "mem: process" line. The walk takes 100-240 ms, and though it runs on its own thread it
holds the process's address-space lock, which the game's threads take at every page fault and VirtualAlloc: the
present after each walk arrived 65-120 ms late, a hitch every ten seconds in every run with the trace on, and the
runs people attach to issues carried it. The walk now runs only with mem_census = 1 (NX2NAVI_MEM_CENSUS); the rest of
the memory lines stay.

Kokiri Forest, trace = perf: before, "slow frame" lines at 601, 1201, 1801, 2401 and 3002 of 65-120 ms with nothing
of it in the pipeline, texture or fence columns; after, none at those frames.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
itaskaev2
2026-11-09 12:50:19 +01:00
committed by chrg6
parent 03e6dac0be
commit 553067ea0b
3 changed files with 13 additions and 4 deletions

View File

@@ -474,6 +474,10 @@
# Extra lines in the log, comma separated: svc, host, ipc, fs, gfx, perf, sched, audio, present or all. The menu's
# Performance log sets perf (frame timings). Default: none.
# trace = perf
# 1: with trace = perf, every 600 frames a walk of the process's address space counts its private and write-combined
# memory (the "mem: process" line). The walk holds the address-space lock for 100-240 ms and delays the next frame by
# as much, so it is off unless asked for.
# mem_census = 0
# Flight recorder: keeps the last frames and saves them to a flight folder next to the folder of nx2navi.exe when a frame
# takes longer than flight_spike_ms (0 to 60000).
# flight = 0