-
Notifications
You must be signed in to change notification settings - Fork 632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running idle still costs 30-50% of cpu #137
Comments
If you wish to release CPU time back to the operating system, what you should do instead is: using (var gw = new GameWindow())
{
gw.VSync = VSyncMode.Adaptive;
gw.RenderFrame += (sender, e) =>
{
gw.SwapBuffers();
Thread.Sleep(1);
};
gw.Run(60);
} This will run GameWindow with 60 UpdateFrame events per second and a variable number of RenderFrame events per second (up to the refresh rate of your monitor.) You can use an OpenGL timer query to measure your GPU performance and adjust (or even skip) |
When running with empty window, GL.Clear(), SwapBuffer() and Thread.Sleep(1): Windows 7 64-bit , GeForce GTX 650, drivers are from this summer. OpenTK 1.1.4. |
Looks like this might be an nVidia thing http://stackoverflow.com/questions/21925313/100-cpu-utilization-when-using-vsync-opengl. Suggestion is that while it says it's using 50% cpu it's actually yeilding control so if something else want to use the CPU it will be able to and the driver will end up at close to 0%. |
I have the same issue, video link: https://www.youtube.com/watch?v=hJf3bTR0Zqo |
@Raptor2277 Did you read the discussion above? |
@mellione Yes, I've tried all the things mentioned above. Still the same result. |
There was a LONG discussion of this in #472 While this may not be EXACTLY the same thing, I'd argue that it's essentially a non-issue. Most games are going to want to run as fast as possible, and don't particularly mind about potentially maxing out one core. |
I'm clueless as to why a GameWindow uses 30-50% of the CPU when it's just running (having created a simple project that just creates a gamewindow and runs it without parameters.). After doing a few profiler tests I've noticed that System.ni.dll takes up 20% of all the GameWindow.Run samples and another 20% inside of GameWindow.DispatchUpdateAndRenderFrame (64%). This is just findings, and might not have anything to do with it but I'm still curious as to what this is and why it's gobbling up so much CPU.
This relates to my 'Game Engine of sorts' having trouble running smoothly at 100 updates per second and using up to 100% of my 4th core while running idle. Again while profiling System.ni.dll and DispatchUpdateAnRenderFrame seem to be the bottlenecks (this leaves very little room for logic). Also ProcessEvents and especially readbit from keyboards seem to take way more cpu time than needed (but this might be a fault on my part).
Is there anything I am doing wrong here? (Do I not grasp how to use a GameWindow?)
I am on Windows 8.1 64x (32-bit exe) with an i5 at 4x2.79GHz by the way, if that changes anything.
The text was updated successfully, but these errors were encountered: