From ab4bd8f8f9dad3d9a3c1933cf5153ae918f16b39 Mon Sep 17 00:00:00 2001 From: chrg6 Date: Tue, 10 Nov 2026 22:34:30 -0500 Subject: [PATCH] Give a slow frame's line under the perf trace its drain wait and replay time, so a stall inside the replay or behind the present thread is no longer read as unnamed. Co-Authored-By: Claude Opus 5.5 --- runtime/perf.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/runtime/perf.c b/runtime/perf.c index b5532c20..23e59b0f 100644 --- a/runtime/perf.c +++ b/runtime/perf.c @@ -827,10 +827,13 @@ void perf_present(uint64_t frame) { char marks[700]; marks[0] = 0; mark_text(&fm, marks, 0, sizeof marks); - rt_log("perf: slow frame %llu: %.1f ms; blocked pipeline %.1f xlate %.1f texture %.1f astc %.1f fence %.1f pacing %.1f%s", + // drain: the wait for the present thread's previous job; replay: the replays since the last present, the + // pipeline, translation and texture waits above included (the rest of a slow frame is the game's own work) + rt_log("perf: slow frame %llu: %.1f ms; blocked pipeline %.1f xlate %.1f texture %.1f astc %.1f fence %.1f pacing %.1f " + "drain %.1f; replay %.1f%s", (unsigned long long)frame, d / 1e6, frame_ns[PERF_PIPE] / 1e6, frame_ns[PERF_XLATE] / 1e6, frame_ns[PERF_TEX] / 1e6, frame_ns[PERF_ASTC] / 1e6, frame_ns[PERF_FENCE] / 1e6, - frame_ns[PERF_PACE] / 1e6, marks); + frame_ns[PERF_PACE] / 1e6, frame_ns[PERF_DRAIN] / 1e6, rep / 1e6, marks); } } memset(frame_ns, 0, sizeof frame_ns);