50% CPU during Demo app

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Hennesey
Posts: 1
Joined: Mon Aug 18, 2008 8:53 am

50% CPU during Demo app

Post by Hennesey »

Hello,
I have downloaded Irrlicht 1.4.1.
When I start the demo my Core 2 Duo goes up to 50% CPU working capacity.
On 1 Core machine, I get always a 100% CPU working capacity.
Is this normal?

Thanks in advance.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Well, I suppose that your second core idles in that moment, which makes 50% according to my arithmetics.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Yep, it's normal. The render loop (while (device->run()) just goes round around without pausing, if you want to reduce the CPU load then you can put a small sleep at the end of the loop. But does it matter if the app is using large amounts of the CPU time? For most cases Irrlicht will be the only app the user is interested in running, though if you're writing a tool of some sort then yeah users might want to be switching to look at folders or other apps at the same time i suppose.
Image Image Image
Blender3D
Posts: 7
Joined: Thu Aug 14, 2008 11:24 am

Post by Blender3D »

I think he wants his Dualcore-machine working with 100% too. If so he has to change his code. OpenMP is a (easy to use) multiprocessing librarie which will make his application working on both cores (with 100%). I guess that he will have to write some extra lines of code if he wants to use openMP.

--Blender3D
cat /dev/brain | sort
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Yeah, but using OpenMP with Irrlicht will be rather difficult...
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Why don't we just hand him a loaded gun and telling him to shove it down his pants with the safety catch off?
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
night_hawk
Posts: 153
Joined: Mon Mar 03, 2008 8:42 am
Location: Suceava - Romania
Contact:

Post by night_hawk »

People could use multiple threads for multiple tasks. One thread for rendering, one for gameplay, one for physics, etc... Those could be a better choice.
Not the best solution, but still (I think...) solves the fact the app uses only one core. (It does, does it? :? )
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Image
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

physics already uses its own thread surely? on PS3 physx runs in its own thread and uses the SPUs so i assumed that all physics engines would utilise an extra thread, makes it fun for adding and removing objects though!
Image Image Image
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Sure, a professional engine on a modern multi-core machine will benefit from threading, but this poster is having trouble seeing why 100% load on a single core is consistent with 50% load on a dual core.

Let's at least let him stab himself with a rogue pointer before we smother him in contention and race bugs.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Darktib
Posts: 167
Joined: Sun Mar 23, 2008 8:25 pm
Location: France

Post by Darktib »

You have a Pentium D?

You have 50% of CPU work because these processors use 2 cores and eachhave it's own memory. But now Intel and AMD have created processors with 1 shared memory for 2 or plus cores.

On a recent engine i'm not sure threads will be more efficient than no thread, even if on an quite older engine (2, 3 years...) it will be a great optimization
vectorcorpse
Posts: 86
Joined: Thu Feb 14, 2008 7:30 pm
Location: Portugal

Re: 50% CPU during Demo app

Post by vectorcorpse »

ok i would be intrested in that small sleep
u see, in linux (windows too, u can set cpu max and min freq in the power management profiles in vista and 7) if u'r familiar with the governor it allows u to set the cpu frequency either a specific one or ondeamand (freq goes up and down has needed avoiding high temperatures) well what happens when irrlicht starts is since it pull all cicles of the cpu core 0 or even on single core is that it triggers the ondemand and pulls the frequency to max forcing the cpu to start heating unnecessarily and i say that becaus if i force the governor to its minimum frequency irrlicht runs at the same fps and performance whatsoever at least until it get some real work to do.
so basically what i want is a chance for governor to work has intended and only scale up the frequency when it is really necessary saving my cpu and its life span.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Re: 50% CPU during Demo app

Post by bitplane »

See the GUI editor source code, if I remember correctly it uses either Device->yield() or Device->sleep(2) to prevent Irrlicht from hogging all the CPU time.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
vectorcorpse
Posts: 86
Joined: Thu Feb 14, 2008 7:30 pm
Location: Portugal

Re: 50% CPU during Demo app

Post by vectorcorpse »

:D nice i'll look in to it this weekend, thx for the tip.
vectorcorpse
Posts: 86
Joined: Thu Feb 14, 2008 7:30 pm
Location: Portugal

Re: 50% CPU during Demo app

Post by vectorcorpse »

:) very nice. I had a quick look at the code and i might add de demo app seams to have a better implementation than the gui editor, i tested the sleep that features in the gui editor in the perpixel lightning tutorial, it works but it is hard do correctly tune since it differs from cpu to cpu, a problem that de demo app doesn't seam to have, does de demo app have any kind of function to adjust the sleep timing acording to the cpu power or the detected fps?!? i din't had the time to look in to it, when i get the time to it i'll have a closer look at the demo app and post my results here. this seam to be an oportunity for a new tutorial to help the noobs that wish to have a more smooth, more stable and better tuned program by requesting only the necessary resources from the computer :P
Post Reply