diff --git a/runtime/perf.c b/runtime/perf.c index b423c65e..e5f8f066 100644 --- a/runtime/perf.c +++ b/runtime/perf.c @@ -478,6 +478,7 @@ typedef struct { // stutter_map.c cause_short and tools/stutter_map.py read these names, in this order. enum { FT_C_PIPE, FT_C_XLATE, FT_C_TEX, FT_C_FENCE, FT_C_PACE, FT_C_HANDOFF, FT_C_REPLAY, FT_C_CENSUS, FT_C_REPORT, FT_C_OTHER, FT_C_N }; +_Static_assert(FT_C_N == STUTTER_CAUSES, "stutter_map.c cause_short and its counts follow FT_C_*"); static const char *const ft_cause_name[FT_C_N] = { "pipeline", "translation", "texture", "fence", "pacing", "hand-off", "replay", "census", "report", "unattributed" }; static uint64_t census_part_ns; // present thread: the census walks since the last present (census_check) diff --git a/runtime/stutter_map.c b/runtime/stutter_map.c index 8ad3709d..8b689b05 100644 --- a/runtime/stutter_map.c +++ b/runtime/stutter_map.c @@ -18,13 +18,13 @@ // 96 ms after an area load (2026-11-13) each counted as a change of pace before, as each was followed by one as long. // // What a hitch went to comes from the frame-time summary's split (perf.c ft_frame: pipeline, translation, texture, -// fence, pacing, hand-off, replay, census, report, unattributed), with the draws that met a pipeline or a shader missing between the previous -// present and this one (stutter_miss, from the replay thread). Each hitch gets a "stutter:" line, at most -// SM_LINES_PER_S a second and SM_LINES_MAX in all; the counts go on past that. Every SM_REPORT_NS of play, when the -// window loses the focus in play (perf.c session_report) and at exit, -// "stutter map" lines rank the areas by their hitches and the pipelines by the time draws lost to them, each with -// whether this install had recorded it before (the pipeline list or an earlier run) and whether one of its shaders was -// translated in play rather than prepared. +// fence, pacing, hand-off, replay, census, report, unattributed), with the draws that met a pipeline or a shader +// missing between the previous present and this one (stutter_miss, from the replay thread). Each hitch gets a +// "stutter:" line, at most SM_LINES_PER_S a second and SM_LINES_MAX in all; the counts go on past that. Every +// SM_REPORT_NS of play, when the window loses the focus in play (perf.c session_report) and at exit, "stutter map" +// lines rank the areas by their hitches and the pipelines by the time draws lost to them, each with whether this +// install had recorded it before (the pipeline list or an earlier run) and whether one of its shaders was translated +// in play rather than prepared. // // Threads: stutter_area runs on the game's loading threads, stutter_miss on the replay thread, stutter_ready on the // pipeline workers (under vk_pipeline.c's P.lock; sm_lock is taken inside it and never takes it), stutter_frame and @@ -42,7 +42,7 @@ int stutter_map_on; #define SM_AREAS 128 // areas kept by name; later ones share the last slot -#define SM_CAUSES 10 // perf.c's FT_C_N +#define SM_CAUSES STUTTER_CAUSES // perf.c's FT_C_N, which perf.c asserts #define SM_LOAD_NS 3000000000ull // after an area load, frames count as the load's for this long #define SM_HITCH_MIN_NS 12000000.0 // a hitch is at least this long... #define SM_HITCH_ANY_NS 25000000ull // ...and any frame over this is one diff --git a/runtime/stutter_map.h b/runtime/stutter_map.h index 5a4afcd6..de259af4 100644 --- a/runtime/stutter_map.h +++ b/runtime/stutter_map.h @@ -22,6 +22,9 @@ void stutter_miss(int shader, int mesh, const uint8_t *vi, const uint8_t *fi, ui void stutter_ready(int mesh, const uint8_t *vi, const uint8_t *fi, double ms, int recorded, int fresh, int fast); // Every present (perf.c ft_frame): d the frame's interval, part the time it went to by cause (names[i], n of them; // the last one is the part nothing recorded explains), cause the one the frame is charged to. +// STUTTER_CAUSES: the number of causes, perf.c's FT_C_N (perf.c asserts it), which stutter_map.c cause_short and the +// areas' counts are sized by; n is that many. +#define STUTTER_CAUSES 10 void stutter_frame(uint64_t frame, uint64_t now, uint64_t d, const uint64_t *part, const char *const *names, int n, int cause); void stutter_report(const char *tag); // the map so far; every 5 minutes of play, at a focus loss in play and at exit