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:
tangerineturtle1
2026-11-09 06:10:06 -05:00
committed by chrg6
parent 0b4622bad1
commit 480a197994
16 changed files with 268 additions and 19 deletions

View File

@@ -52,6 +52,12 @@ void perf_count(int kind);
// and resource binds between them; xfer is copies and clears.
enum { PERF_RP_DRAW, PERF_RP_BIND, PERF_RP_XFER, PERF_RP_OTHER, PERF_RP_N };
void perf_replay_op(int cat, uint64_t ns);
void perf_replay_op_at(int cat, uint32_t op, uint64_t ns);
void perf_replay_cpu(uint64_t ns); // the replaying thread's CPU time over one submission's replay (vk_sync.c) // as perf_replay_op, also kept per frame for slow frames
void perf_lock_timing_here(void);
int perf_lock_holds_on(void); // NX2NAVI_LOCK_TIME
void perf_lock_hold(void *site, uint64_t ns); // a lock held ns from site (vk_texture.c, holds over 1 ms) // NX2NAVI_LOCK_TIME: this thread's lock waits go into the frame-time summary
extern void (*perf_rec_waits)(uint64_t *full_ns, uint64_t *drain_ns); // set by the back end (vk_rec.c totals)
void perf_present(uint64_t frame);
void perf_summary_flush(void); // prints the frame-time summary of the running period (exit); the 60 s lines come from perf_present
void gfx_exit_log(void); // back end's lines for the exit summary (weak no-op in prof_win.c)