Log a game thread that waits 10 s for a lock or for another thread to end, with what the other thread is doing.

A game that stops with nothing in its log leaves no clue to which threads wait for which. A thread of its own now
looks every 2 s for guest threads blocked that long on a lock (ArbitrateLock) or on another thread's end
(WaitSynchronization on a thread handle) and logs each such wait once: the waiter, the lock's holder or the thread
waited for, and whether that one is itself waiting and on what. Waits on condition variables, events and addresses
are left out, since idle worker threads wait on them for good. At most 24 lines a run. NX2NAVI_WAIT_WATCH_S sets the
threshold (10; 0 off). The wait's start is now kept for every blocking wait, not only under the sched trace.

Checked: the runtime compiles and tests/sync_wake_check.py passes. A 90 s run with WAIT_WATCH_S=1 logged one chain
during an area load ("thread 0x102d has waited 3 s for the lock ... held by thread 0x105a, itself waiting 2.6 s"),
and nothing in steady play; with the default of 10 s, earlier runs log nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-11 18:10:04 -05:00
parent e96a89c31c
commit 1771775e3c
3 changed files with 66 additions and 1 deletions

View File

@@ -755,6 +755,10 @@
# Extra lines in the log, comma separated: svc, host, ipc, fs, gfx, perf, sched, audio, present, coop or all. The menu's
# Performance log sets perf (frame timings). Default: none.
# trace = perf
# A game thread that waits this many seconds for a lock, or for another thread to end, is logged once with the thread
# it waits for and what that one is doing (at most 24 lines a run): a game that stops then leaves the chain in its log.
# 0: off. Default: 10.
# wait_watch_s = 10
# 1: with trace = perf, walks of the process's address space count its private and write-combined memory every 600
# frames (the "mem: process" line) and where its committed memory lies every 3600 frames (the "commit census" lines).
# Each walk holds the address-space lock for 100-240 ms and delays the next frame by as much, so they are off unless