Pages: « 1 2 3 »
  Print  
Author Topic: Overuse of the CPU ?  (Read 6955 times)
Offline (Male) Goombert
Reply #15 Posted on: July 03, 2013, 05:44:08 PM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3110

View Profile
Deus, also, I am planning a profiler to be integrated with debug that will output things such as ram and vram and cpu usage >:
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) egofree
Reply #16 Posted on: July 04, 2013, 04:31:20 AM
Contributor
Joined: Jun 2013
Posts: 603

View Profile Email

Try turning off the background in room, if that doesn't show anything then set automatic redrawing to false. I don't think "Sleep on minimize" thing is implemented, but if it is then try that as well.

It doesn't change anything. I tried also with OpenGL 3.0 but it doesn't change the result. By the way, it's not possible to make an executable with Open 3.0, i've error messages. I've found an Open GL profiler : http://www.gremedy.com/free_license.php. Here is the result :







I don't know if it's useful for you.
« Last Edit: July 04, 2013, 04:33:39 AM by egofree » Logged
Offline (Unknown gender) TheExDeus
Reply #17 Posted on: July 04, 2013, 05:56:33 AM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
Well first, GL1 doesn't work for me but GL3 does. So that is also weird.
Second, was this for empty game?
And can you give the information about profiling - like the time and cpu usage inside the debugger. The information you provided is what GL functions it called, but sadly it doesn't give information on how long they took.
I can render an empty room with just 1 object which draw fps with 0% CPU load. Even when I render 999FPS. When I set it to 9999FPS then I get 2400 actual FPS and cpu load is 16%. This is on a laptop with an ATI card and 2.5Ghz I3. When I check CPU load with profiler I get 3-12% and it varies all the time. In the task manager I still get 0% though.
Do you use any anti-virus?

Thanks about the profiler link. Didn't know it's freeware now. It is very good profiler.

edit: And Robert, do you plan to remake all the drawing functions OGL3? I see that it still uses immediate mode.
« Last Edit: July 04, 2013, 05:58:35 AM by TheExDeus » Logged
Offline (Unknown gender) egofree
Reply #18 Posted on: July 04, 2013, 02:53:22 PM
Contributor
Joined: Jun 2013
Posts: 603

View Profile Email
Second, was this for empty game?

Yes.

Do you use any anti-virus?

Yes, but i tried already to disable it, but it doesn't change anything. With gDEBugger, i tried also to see if it's possible to see CPU use for each function, but i don't think it's possible. Finally i tried an c/c++ profiler on Windows : very sleepy (http://www.codersnotes.com/sleepy). Here is the result :

First screen :



Second screen, it's the breakdown of the thread which uses almost all CPU power :



And my task manager (to prove i am not lying  :D ) :

Logged
Offline (Unknown gender) TheExDeus
Reply #19 Posted on: July 04, 2013, 03:16:37 PM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
It seems the very cool sleep function isn't that cool after all. Try setting room speed to 999 (which should disable sleep) and see what you get (and check if you get stable 999, if not then set it lower so it's stable).
Here is mine: http://imageshack.us/a/img59/1533/52h1.png
So I clearly don't have it. It is weird that sleep eats so much CPU for you though. Maybe forthevin knows more.
Logged
Offline (Unknown gender) egofree
Reply #20 Posted on: July 04, 2013, 04:54:57 PM
Contributor
Joined: Jun 2013
Posts: 603

View Profile Email
It seems the very cool sleep function isn't that cool after all. Try setting room speed to 999 (which should disable sleep) and see what you get (and check if you get stable 999, if not then set it lower so it's stable).

Interesting. I tried many different values, and here is the result:

Room speed between 1 and 59 -> CPU 13 %
Room speed between 60 and 999 -> CPU 25 %
« Last Edit: July 05, 2013, 01:57:42 AM by egofree » Logged
Offline (Male) Josh @ Dreamland
Reply #21 Posted on: July 04, 2013, 05:43:22 PM

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2960

View Profile Email
It uses 13% CPU at 1 FPS?
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) egofree
Reply #22 Posted on: July 05, 2013, 02:00:37 AM
Contributor
Joined: Jun 2013
Posts: 603

View Profile Email
It uses 13% CPU at 1 FPS?

Yes, i tested also with with room speed 1, and CPU use is 13%. In an 'empty' project, it seems there is only two possible values for CPU use on my computer : 13 and 25 %.
Logged
Offline (Unknown gender) TheExDeus
Reply #23 Posted on: July 05, 2013, 02:01:31 AM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
Josh, by the looks of the profiling the Sleep() function is the one eating the CPU. So if it sleeps for 59/60 then it will eat as much or even more CPU. Maybe I am wrong though as I can't find a topic on the internet about Sleep() using much CPU. Here is an interesting article on how to make it use certain amount of CPU - http://www.codeproject.com/Articles/28870/Better-Way-to-Sleep-Control-Execution-and-Limit-CP . But I don't think we should limit a game to run at certain %. Could be a cool optional feature though for creating programs that are meant to run in background.

25% is 1 core and you will not get more with a single threaded application like an enigma game. Though that means you exceeded stable FPS. Try drawing fps (draw_text(10,10,string(fps)) to see what you actually get. If you set it to 100, then you get 100? And max CPU load (25%)? And when set to 400 you also get 400, but with max cpu load (25%)?
« Last Edit: July 05, 2013, 02:03:47 AM by TheExDeus » Logged
Offline (Unknown gender) egofree
Reply #24 Posted on: July 05, 2013, 02:37:42 PM
Contributor
Joined: Jun 2013
Posts: 603

View Profile Email
25% is 1 core and you will not get more with a single threaded application like an enigma game. Though that means you exceeded stable FPS. Try drawing fps (draw_text(10,10,string(fps)) to see what you actually get. If you set it to 100, then you get 100? And max CPU load (25%)? And when set to 400 you also get 400, but with max cpu load (25%)?

Room speed   FPS    CPU load
-------------------------------------
30                   30        14
60                   60        25
100                 60        25
400                 60        25
Logged
Offline (Male) Josh @ Dreamland
Reply #25 Posted on: July 05, 2013, 03:18:40 PM

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2960

View Profile Email
I just couldn't believe that Sleep() implementation is so stupid. Operating systems are supposed to love Sleep, because they can all but completely ignore a sleeping thread until its condition is met. Does Notepad use 13% CPU on your machine? :P
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) egofree
Reply #26 Posted on: July 06, 2013, 04:46:48 AM
Contributor
Joined: Jun 2013
Posts: 603

View Profile Email
Does Notepad use 13% CPU on your machine? :P

Only Notepad++ does, but Notepad is ok !  :P  :)
« Last Edit: July 06, 2013, 04:52:53 AM by egofree » Logged
Offline (Male) Goombert
Reply #27 Posted on: July 06, 2013, 11:36:56 PM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3110

View Profile
Here I got the answer Josh, Windows sucks, there you go have a nice fucking day. As far as those deprecated GL functions go, much of the OpenGL3 graphics system is still using software rendering for some things, just about the only thing I've changed is using Vertex Buffers for models.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) TheExDeus
Reply #28 Posted on: July 07, 2013, 05:57:22 AM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
But as far as I can tell he is the only Windows user we have who has this problem. It's weird, but still shows that it could be something specific to him. ego, have you tried on another PC? And if you sometime in the future reinstall Windows then try again. And did you actually install the OS or was it preinstalled with the PC?

edit: And what is this TestOpenGL.exe you are running all these tests? Is it really an empty game? I guess you would notice if it wasn't...
« Last Edit: July 07, 2013, 06:01:31 AM by TheExDeus » Logged
Offline (Unknown gender) egofree
Reply #29 Posted on: July 07, 2013, 06:56:07 AM
Contributor
Joined: Jun 2013
Posts: 603

View Profile Email
But as far as I can tell he is the only Windows user we have who has this problem. It's weird, but still shows that it could be something specific to him. ego, have you tried on another PC? And if you sometime in the future reinstall Windows then try again. And did you actually install the OS or was it preinstalled with the PC?

edit: And what is this TestOpenGL.exe you are running all these tests? Is it really an empty game? I guess you would notice if it wasn't...

I've totally re-installed my PC (Alienware X51) several weeks ago, because i know it had a lot of crap on it and i've installed also an anti-virus. I tried to install as much as possible open-source software.
I've got another mini-PC, a Dell Studio Hybrid, which is several years old, with a dual boot (Vista and Linux mint). I tried the empty project on Vista : CPU load 50 % !!! I know the computer is not very powerful, but we are talking about an empty project. I analysed the exe with anti-virus and it doesn't seem to find any viruses :https://www.virustotal.com/en/file/a4aa8fe98dfcb0a08a71ada1e4f96ae193d8eec06428cd8110cd6a421e7eb7fb/analysis/1373196738/. I tried also to install ENIGMA on this mini-PC and i created an empty project, but the result is the same. Java is up-to-date.

To create an 'empty' project, i just do this :  right-click sprite, create a new one, and choose an image, then right-click object, create a new one and choose the sprite, and finally right click room, create a new one add the object to the room. In any case, you can download there the exe of the empty project : http://www35.zippyshare.com/v/24257123/file.html

I know i already told you, but in any case, thanks for your support, TheExDeus, i really appreciate.
« Last Edit: July 07, 2013, 12:30:21 PM by egofree » Logged
Pages: « 1 2 3 »
  Print