how does presentmon calculate the fps?
hello, i'm trying to use presentmon in my application. the way i show "current fps" is by getting the last 10 (1000/msBetweenPresents) records and get the average number, but obviously this is not accurate at all.
how does presentmon calculates this value (38.2 value in the screenshot below)?
thank you in advance!
EDIT/ i know i'm supposed to look at the source code, but i have a really hard time navigating around the c++ code. sorry about that!
No problem about reading the code, these sorts of questions are totally fine for the github issues.
You should either use harmonic_mean(1000/msBetweenPresents) or 1000/mean(msBetweenPresents).
The console application uses the latter along with the optimization: mean(msBetweenPresents) = (last_present_time - first_present_time) / (num_presents - 1). And it computes the average over the last 120 frames, or the last 2 seconds worth of frames, which ever is less.
Code is here: https://github.com/GameTechDev/PresentMon/blob/main/PresentMon/Console.cpp#L267
HTH