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. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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().Framerate
to 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_Time
is initialized and right after that, there is aImGui_ImplWin32_NewFrame
called 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_time
initialization, 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
Beta Was this translation helpful? Give feedback.
All reactions