NogginBops / ImGui.NET_OpenTK_Sample

A sample project showing an ImGui (using ImGui.NET) renderer for OpenTK in C#
106 stars 27 forks source link

CPU usage seems unusually high when imgui windows are drawn . #11

Closed KillzXGaming closed 3 years ago

KillzXGaming commented 3 years ago

The CPU usage seems unusually high, around %30 if any imgui windows are open. If all windows are disabled (like ShowDemoWindow() in Window.cs OnRenderFrame() being removed, the CPU usage is normal. If anyone window is drawn, the usage spikes back to %30.

image

Disabled windows:

image

NogginBops commented 3 years ago

Thanks for the report

Could you have more information on the machine you are using? Cpu, gpu, ram etc. As well as what branch of this repo you are using. And if you can the gpu driver version you are using.

KillzXGaming commented 3 years ago

Master Branch I also tried both the 3.3 and 4.0 branch which both gave the same issue.

Windows 10 v10.01904 BUILD 19041 CPU : I5-4670 3.40ghz GPU : Nvidia GTX 970 (driver v445.87) RAM : 8gb

I'll also try updating my GPU drivers to make sure if that fixes them or not.

Edit: Also happens on all 3 branches after updating my drivers to the latest. (456.38)

NogginBops commented 3 years ago

Hello again @KillzXGaming , sorry for not responding eariler. I tried looking into the issue but I couldn't really find anything out of the ordinary using my machine. I get a pretty consistent 5-6% cpu usage, and if I disable VSync I get about 20% cpu usage (which is expected, for me it's rendering at 2k fps).

I'm not able to reproduce your issue where drawing no windows has remarkable less cpu usage than drawing. If you could run the VS sampling profiler (at a high sample rate, look in the settings) on the project when drawing windows and not drawing windows I might be able to figure something out from that. You can just save the profile results and upload the files here.

KillzXGaming commented 3 years ago

Sorry for the late reply. This can be closed now. It had high usage due to calling GL.Error() each frame so it actually works perfectly fine in release mode.