Skip to content

Commit

Permalink
Add stability metric
Browse files Browse the repository at this point in the history
Percentage of frames that were at or above com_maxfps value
  • Loading branch information
Aciz committed Aug 11, 2024
1 parent dd8307e commit 0909e00
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/client/cl_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,7 @@ static void CL_TimedemoResults(void) {
int onePercentIdx, pointOnePercentIdx;
float fps, minFps, maxFps;
char onePercent[8], pointOnePercent[8];
int desiredFrametime, numOptimalFrames;

time = Sys_Microseconds() - clc.timedemo.timeDemoStart;

Expand Down Expand Up @@ -844,15 +845,25 @@ static void CL_TimedemoResults(void) {
Com_sprintf(pointOnePercent, sizeof(pointOnePercent), "%3.2f", 1000000.0f / sortedFrametimes[numFrames - 1 - pointOnePercentIdx]);
}

desiredFrametime = 1000 / com_maxfps->integer;
numOptimalFrames = 0;

for (i = 0; i < numFrames; i++) {
if (sortedFrametimes[i] / 1000.0f <= desiredFrametime) {
numOptimalFrames++;
}
}

Com_Printf("\n----- Benchmark results -----\n");
Com_Printf("\n%-18s %3.2f sec\n%-18s %i\n%-18s %3.2f\n%-18s %3.2f\n%-18s %3.2f\n%-18s %s\n%-18s %s\n",
Com_Printf("\n%-18s %3.2f sec\n%-18s %i\n%-18s %3.2f\n%-18s %3.2f\n%-18s %3.2f\n%-18s %s\n%-18s %s\n%-18s %3.2f pct\n",
"Time elapsed:", time / 1000000.0f,
"Total frames:", numFrames,
"Minimum fps:", minFps,
"Maximum fps:", maxFps,
"Average fps:", fps,
"99th pct. min:", onePercentIdx ? onePercent : "--",
"99.9th pct. min:", pointOnePercentIdx ? pointOnePercent : "--");
"99.9th pct. min:", pointOnePercentIdx ? pointOnePercent : "--",
"Stability:", (float)numOptimalFrames / (float)numFrames * 100.0f);
Com_Printf("\n-----------------------------\n\n");
}

Expand Down

0 comments on commit 0909e00

Please sign in to comment.