Number RivaTuner Statistics Server's profile created and removed lines, so a play-test can count the churn.

The review found that numbering these lines had been set aside as the performance branch's work, while it is the part
of A-10 that may land on its own, and only this branch writes rtss_limit.c. A want that flips between a limit and kept
out (low latency before the first swapchain and during a rebuild, or switched in the menu) creates the profile and
removes it again at each flip; the play-test's live toggles item counts those lines. rtss_limit.c apply now ends the
created line with "(creation N this run)" and put_back the removed line with "(removal N this run)", counted under the
lock both run under. The settle rule that would stop the churn still waits for approval.

tests/rtss_worker_check.c churn_run also checks that the ten flips log creations 1 to 6 and removals 1 to 5 and no
more. rtss_limit_check passes 24 of 24.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-13 17:48:51 -05:00
parent 3b250adffd
commit 9c32d3bca9
2 changed files with 13 additions and 4 deletions

View File

@@ -67,6 +67,7 @@ static RtssState S = RTSS_STATE_INIT; // the worker's decisions (rtss_decide.h
static int has_denominator; // this RTSS knows FramerateLimitDenominator
static int had_profile; // the profile existed before this run changed it
static DWORD old_limit, old_denominator = 1;
static int creations, removals; // the profile's "created" and "removed" lines this run, numbered for the log (under lock)
// RTSS's shared memory as rtss_parse reads it: whether RTSS runs, whether it lists this process, and its frame count.
static void rtss_map(RtssApp *a) {
@@ -170,8 +171,9 @@ static int apply(void *ctx, int64_t mhz, int first, int clear) {
return RTSS_WROTE_READONLY;
}
if (first) {
if (!had_profile)
rt_log("frame rate: RivaTuner Statistics Server profile %s created; it goes away when the game closes", profile);
if (!had_profile) // numbered: a want that flips between a limit and kept out creates it again at each flip
rt_log("frame rate: RivaTuner Statistics Server profile %s created; it goes away when the game closes "
"(creation %d this run)", profile, ++creations);
else
rt_log("frame rate: RivaTuner Statistics Server profile %s held a limit of %lu/%lu; it gets that back when the "
"game closes", profile, old_limit, old_denominator);
@@ -198,7 +200,8 @@ static int apply(void *ctx, int64_t mhz, int first, int clear) {
static void put_back(void) {
if (!had_profile) {
delete_profile(profile);
rt_log("frame rate: RivaTuner Statistics Server profile %s removed, as before the game started", profile);
rt_log("frame rate: RivaTuner Statistics Server profile %s removed, as before the game started (removal %d this "
"run)", profile, ++removals);
} else if (write_limit(old_limit, old_denominator) > 0) {
rt_log("frame rate: RivaTuner Statistics Server profile %s has its limit of %lu/%lu back", profile, old_limit,
old_denominator);

View File

@@ -637,7 +637,7 @@ static void library_run(void) {
}
// Low latency switching on and off at every poll (the want flips between a limit and kept out): each switch writes or
// puts back the profile, as it stands.
// puts back the profile, as it stands, and the log numbers each creation and removal so a play-test can count them.
static void churn_run(void) {
app_set(1, 0xA, 1000, 2000, 60);
ask(60000);
@@ -648,6 +648,12 @@ static void churn_run(void) {
}
show("ten polls with the want flipping");
CHECK(created == 6 && removed == 5, "%ld creations, %ld removals", created, removed);
CHECK(logged("created; it goes away when the game closes (creation 1 this run)\n") &&
logged("(creation 6 this run)\n") && !logged("(creation 7"),
"the created lines are numbered");
CHECK(logged("removed, as before the game started (removal 1 this run)\n") && logged("(removal 5 this run)\n") &&
!logged("(removal 6"),
"the removed lines are numbered");
CHECK(rtss_limit_active(), "RTSS limits after the last want of a limit");
}