mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 02:09:57 -04:00
Add replay diagnostics that found this session's frame-time dips, all off by default.
lock_time (NX2NAVI_LOCK_TIME) makes the replay threads time each lock they have to wait for, kept per asking site (platform.h plat_lock_timing, plat_mutex_lock_at and plat_rmutex_lock_at carry the site), and the frame-time summary lists the sites with the most wait, the recorder's full-ring and drain waits, and the texture lock's holds over 1 ms with the code that took it. replay_time now also keeps each frame's replay ops: a frame over 25 ms charged to the replay says how many draws, binds and transfers it replayed, their time, its slowest op, and how much of the replay's wall time the thread was on the CPU. NX2NAVI_PROFILE_REPLAY=1 samples only the replay thread without call chains, and the profiler now follows the thread that replays instead of the one that started the back end. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -161,6 +161,14 @@ void plat_rmutex_lock(PlatRMutex *m);
|
||||
int plat_rmutex_trylock(PlatRMutex *m); // 1 when acquired (or already held by this thread)
|
||||
void plat_rmutex_unlock(PlatRMutex *m);
|
||||
|
||||
// Lock-wait timing (NX2NAVI_LOCK_TIME, perf.c): after plat_lock_timing(fn) on a thread, each plat_mutex_lock(_shared)
|
||||
// or plat_rmutex_lock there that has to wait calls fn with the address of the code that asked for the lock (for a
|
||||
// recursive mutex, the caller of plat_rmutex_lock) and the nanoseconds it waited. NULL turns it off. Windows only.
|
||||
typedef void (*PlatLockNote)(void *site, uint64_t ns);
|
||||
void plat_lock_timing(PlatLockNote fn);
|
||||
void plat_mutex_lock_at(PlatMutex *m, void *site); // plat_mutex_lock reporting site as the asker
|
||||
void plat_rmutex_lock_at(PlatRMutex *m, void *site); // plat_rmutex_lock reporting site as the asker
|
||||
|
||||
// One-time initialisation: the first caller runs fn(arg), every other caller waits until it returned. Zero-initialised
|
||||
// (PLAT_ONCE_INIT) has not run.
|
||||
typedef struct { volatile int32_t state; } PlatOnce;
|
||||
|
||||
Reference in New Issue
Block a user