Getting an accurate framerate from ImGui::IO #4138
Nemirtingas
announced in
Old/Archived discussions
Replies: 1 comment 1 reply
This is not the "immediate/current" framerate, it is the rolling average framerate over the last 120 frames. However we computed the rolling average wrongly for the first 120 frames. I improved the code now: But don't expect this to be very useful for your purpose, and don't expect initial first few frames of your app to be meaningful as many components and systems will be warming up. |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi,
I'm quite puzzled actually. I was making a perf counter window, I added a fps counter as well as a min/max fps.
I used
ImGui::GetIO().Framerateto get the immediate framerate, there is a big spike at start and it mess my stats because I also capture the best/lowest fps of the application lifetime. I think it is caused byImGui_ImplWin32_Init,g_Timeis initialized and right after that, there is aImGui_ImplWin32_NewFramecalled making Dear ImGui computes some wrong framerate. With the current Dear ImGui code, my max constant framerate is 120fps, never higher.Then I removed the
g_timeinitialization, that way, the first frames are near 0, but by doing so, my max constant framerate is always around 122-125fps.I can reproduce this everytime, any idea on how initializing g_time to 0 instead of the current time makes the max framerate caps at 122 fps instead of 120fps ?
https://imgur.com/a/FSN5iyF
All reactions