Make the stutter map count runs of long frames as one hitch and the texture pool's area loads as loads.

In the 2026-11-13 session three frames of 87, 91 and 96 ms after an area load each counted as a change of pace, as each was followed by one as long, and loads that only the texture pool saw (no area file read, so no scene line) were charged to play. Consecutive long frames are now one episode, counted once with their summed time, its line giving that time and the first frame's parts; a run of more than 8 long frames none of which stands out is still a change of pace. The texture pool's start and end of an area load mark an area load for the map, as the game's own loads do.

With trace = perf, the slow write-watch queries and freezes past the 200 lines they may log are counted and given every 60 frames, so a late area load still shows them; the session's lines had run out by frame 36,387.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-13 12:54:05 -05:00
parent 7b3edac140
commit 2f640fb8ed
6 changed files with 118 additions and 18 deletions

View File

@@ -48,14 +48,33 @@ int main(void) {
frames(200, 7.0);
for (int k = 0; k < 5; k++) frames(1, 30.0), frames(60, 7.0); // five isolated spikes
expect("five isolated spikes", areas[0].hitch, 5);
frames(1, 150.0), frames(1, 150.0), frames(60, 7.0); // two long frames in a row: the second stands out
expect("two frames over the sure line", areas[0].hitch, 7);
frames(1, 40.0), frames(1, 40.0), frames(60, 7.0); // a double spike: the second one counts
expect("a double spike", areas[0].hitch, 8);
frames(1, 150.0), frames(1, 150.0), frames(60, 7.0); // two long frames in a row: one episode of 300 ms
expect("two frames over the sure line", areas[0].hitch, 6);
expect("their episode's time", areas[0].worst_ns, 300000000ull);
frames(1, 40.0), frames(1, 40.0), frames(60, 7.0); // a double spike: one episode
expect("a double spike", areas[0].hitch, 7);
// three long frames, each followed by one as long, as after an area load in a session of 2026-11-13 (87, 91 and
// 96 ms): one episode, not three changes of pace
uint64_t paced0 = paced_out, charged0 = areas[0].cause_ns[7];
frames(1, 87.0), frames(1, 91.0), frames(1, 96.0), frames(60, 7.0);
expect("three slow frames in a row", areas[0].hitch, 8);
expect("not a change of pace", paced_out, paced0);
expect("the episode's time", areas[0].cause_ns[7] - charged0, 274000000ull);
// a change to 30 fps from 140: a run of long frames longer than SM_EPISODE_MAX, a change of pace
frames(200, 7.0);
frames(300, 33.3);
expect("a change to 30 fps", areas[0].hitch, 8);
frames(200, 7.0);
stutter_area("Kakariko"); // a load: what follows within SM_LOAD_NS is the load's
frames(1, 60.0), frames(30, 7.0);
expect("a spike right after a load (play)", areas[1].hitch, 0);
expect("a spike right after a load (load)", areas[1].load_hitch, 1);
clock_ns += 10000000000ull;
frames(60, 7.0);
stutter_load(); // the texture pool's load of an area, without the game's
frames(1, 60.0), frames(30, 7.0);
expect("a spike right after the pool's load (play)", areas[1].hitch, 0);
expect("a spike right after the pool's load (load)", areas[1].load_hitch, 2);
if (!logged) printf("FAIL nothing was logged\n"), fails++;
if (fails) return 1;
printf("stutter_hitch_check: all checks passed\n");