Closed dzid26 closed 6 months ago
Could you show me the circumstances under which these usages take place? This is my usage when STMViewer is minimized:
(Branch jlink_hss @ b6371ef)
All the time.
In general the usage is not big (usually 2%) but it jumps to 5% periodically.
Examples (after loading config and minimizing.) (When recording is active, the effect on GPU is slightly lesser. )
https://github.com/klonyyy/STMViewer/assets/841061/79d86b5d-a6b1-4129-a473-e70b54eea0b6
https://github.com/klonyyy/STMViewer/assets/841061/58e69c3a-afc5-450b-8a8f-20b8264e1a1d
I am expecting there could be 0% when stopped. But if imgui is not efficient about mouse events, etc.., then at least maybe we can pause it when minimized.
Thanks
Please let me know if the latest commit solved the issue. Thanks for bringing it out!
Strangely, today, I couldn't reproduce 5% CPU spikes on any version.
Version 0.4 & 0.5:
With GLFW_FOCUSED
:
But the cursors don't refresh when hovering. Not sure if that is useful for anything.
Since the issue doesn't seem as bad as I thought, I guess we could check for "minimized" only?
This works:
if (glfwGetWindowAttrib(window, GLFW_ICONIFIED))
Yeah, I was thinking of the GLFW_ICONIFIED however this does not seem to limit the rendering whenever the windows is overlayed by another window (not minimized explicitly). Let's stick with it and see if someone complaints about the high CPU/GPU usage after this fix.
Actually, we also could add this in the while loop as another simple efficiency improvement:
if (glfwGetWindowAttrib(window, GLFW_FOCUSED) || (tracePlotHandler->getViewerState() == PlotHandlerBase::state::RUN) || (plotHandler->getViewerState() == PlotHandlerBase::state::RUN))
glfwSwapInterval(1);
else
glfwSwapInterval(4);
1% instead of 4% GPU usage with visible window.
Would you be willing to implement and test that in a PR to the devel branch?
Windows 11. There is constant small CPU/GPU usage even when acquisition is stopped and app is minimized.
Can we pause the rendering at least under those conditions?