diff --git a/runtime/cfg.c b/runtime/cfg.c index b2dbf1a0..3fed6617 100644 --- a/runtime/cfg.c +++ b/runtime/cfg.c @@ -34,7 +34,7 @@ static const char *const known[] = { "MOVIE_PACE", "OPERATION_MODE", "PERF_SLOW_MS", "PIPELINE_CACHE", "PIPE_PREBUILD", "PIPE_SKIP", "PIPE_SYNC", "PIPE_WAIT", "PREWARM_XLATE", "PROBE_MOVIE", "PROBE_MOVIE_SHOT", "PROFILE", "PROFILE_CHAINS", "PROFILE_DIR", "PROFILE_FRAMES", "PROFILE_RENDER", "PUSH_SKIP", "PUSH_STAGE", "RDOC", - "RDOC_DIR", "RDOC_DLL", "REALTIME", "REEXEC", "RESOLVE_CHECK", "ROMFS", "ROMFS_INDEX", "ROMFS_MMAP", "ROMFS_MODS", "ROMFS_PATCHES", + "RDOC_DIR", "RDOC_DLL", "REALTIME", "REEXEC", "REPLAY_ASYNC", "RESOLVE_CHECK", "ROMFS", "ROMFS_INDEX", "ROMFS_MMAP", "ROMFS_MODS", "ROMFS_PATCHES", "ROMFS_PROOF_DIR", "ROMFS_VERIFY", "RUMBLE", "RUMBLE_CURVE", "RUMBLE_STRENGTH", "RUMBLE_TRIGGERS", "SHADER_CACHE", "SHADER_MEMO", "SHARED_FONTS", "SHOTS", "SHOTS_DIR", "SHOTS_FULL", "SPEED_PROBE", "SPLIT_DRAWS", "SWKBD_ANSWER", "SWKBD_TEST", "TEST_PREPARE_SHADERS", "TEX_ALIAS", "TIMER_1MS", diff --git a/runtime/host.h b/runtime/host.h index 3deb7aa2..a1c42f32 100644 --- a/runtime/host.h +++ b/runtime/host.h @@ -42,6 +42,7 @@ enum { PERF_CNT_PIPE_ASYNC, PERF_CNT_PIPE_SKIP, PERF_CNT_TEX_UP, PERF_CNT_TEX_RE void perf_count(int kind); 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) void perf_gpu_wait(uint64_t t0); // a wait for a GPU fence ended (any thread; the render thread's also counts as PERF_FENCE) // GPU side of the 60-frame perf line, filled by the graphics back end when it set perf_gpu_stats. gpu_ns: GPU busy time // since the previous call (timestamp queries, overlaps counted once), have_gpu 0 when the device has no timestamps. diff --git a/runtime/prof_win.c b/runtime/prof_win.c index 35b7fe4f..48e5a77b 100644 --- a/runtime/prof_win.c +++ b/runtime/prof_win.c @@ -350,8 +350,13 @@ static void ft_report(uint64_t now, const char *tag) { ft.t0 = now; } +__attribute__((weak)) void gfx_exit_log(void) {} + void perf_summary_flush(void) { // at exit (prof_write) - if (summary_t0) ft_report(kern_now_ns(), "exit"); + if (summary_t0) { + ft_report(kern_now_ns(), "exit"); + gfx_exit_log(); + } summary_t0 = 0; } diff --git a/runtime/vk_backend.c b/runtime/vk_backend.c index 3dd6d0c8..5ae049a8 100644 --- a/runtime/vk_backend.c +++ b/runtime/vk_backend.c @@ -284,6 +284,13 @@ static void replay_log(uint64_t frame, int total) { k ? buf : " no waits"); } +// The run total, once: the game exits through prof_write (boot.c _exit, the window close), probes through +// vk_backend_shutdown. +void gfx_exit_log(void) { + static LONG done; + if (gfx_replay_async() && r_started && !InterlockedExchange(&done, 1)) replay_log(game_frames, 1); +} + static void vk_be_present(const tex_t *t, const int crop[4], uint64_t at_ns) { vk_sync_start(); if (!gfx_replay_async()) { @@ -400,7 +407,7 @@ const GfxBackend gfx_vulkan_backend = { void vk_backend_shutdown(void) { replay_drain(DR_FINISH); - if (gfx_replay_async() && r_started) replay_log(game_frames, 1); + gfx_exit_log(); vk_present_drain(); vk_sync_shutdown(); vk_mem_shutdown();