Jump to content
  • Advertisement
Sign in to follow this  
Maxjen

Program using too many resources

This topic is 2237 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

I have a little problem with my program. It's a simple opengl application but it uses too many resources. Whenever I start it my processor fan gets very loud after a few seconds and I don't understand why. I think the problem is connected to my main loop. It is an indefinite while loop so it makes sense to me that my computer should be working at all times. However there must be something that other games do differently, because I don't hear my processor fan while playing them. Can someone tell me what that might be?

My best guess is that I'm doing too much during each execution of the while loop. I have a list of objects which are simulated by box2d and update their position and rotation at every iteration of the loop. Should I rather update them only after certain timesteps? But if this is true I still don't understand why because then each iteration would finish faster but there would also be more iteration so my computer should still be working all the time and thus use the same amount of resources, right? I hope someone can explain this to me.

Share this post


Link to post
Share on other sites
Advertisement
Note that there might be better ways to do this.

But try putting a Sleep(millisecondshere); in the loop. It stops executing the program for a small time, so if theres nothing to compute you can make it sleep for a while. You probably need to include windows.h or some other header.

Also are you sure its the processor fan and not the GPU fan?

You would probably use it by timing your loop iteration, and if theres still time until the start of the next time step, sleep for a while.

Share this post


Link to post
Share on other sites
Whenever I start it my processor fan gets very loud after a few seconds and I don't understand why.[/quote]

Poor hardware build. The fan is borderline for the CPU/GPU, so even slightest load increase causes a ramp up. Add to that airflow that isn't optimized for noise, possibly cheap(er) bearings, perhaps slightly-off thermal diode.


A noise-aware hardware configuration should be inaudible even when running at 100% load on everything, CPU/GPU/RAM/Northbridge/DVD/USB/TLA/ETC....

Noise is often not a factor or at least it's assumed that user will never go over a few percent.

Many laptops are not even remotely built for >25% load, so a dual core machine that runs Flash on single core will peg the fans.

And yes, many Macs fail on all of the above.

Share this post


Link to post
Share on other sites
Thanks for the replies.


But try putting a Sleep(millisecondshere); in the loop. It stops executing the program for a small time, so if theres nothing to compute you can make it sleep for a while. You probably need to include windows.h or some other header.
...
You would probably use it by timing your loop iteration, and if theres still time until the start of the next time step, sleep for a while.

Is this the same thing as capping the framerate? I might actually do that. In fact I just found out that the game I was comparing it with (braid) also caps the framerate at 30. I'll try to find out how to do this sleep thing on linux.

I'm still wondering though if there is anything else I might be doing wrong? Because I feel that even games like ut2004 where I have over 100 frames per second don't create as much noise as mine.(although that's maybe operating system related as that was on windows or my feeling is deceiving me)


Also are you sure its the processor fan and not the GPU fan?

It might be the GPU fan, I have no idea.

Antheus:
It is true that I have a poor hardware build. My laptop is noisy with every game I play. I was just wondering because with my program it is especially noisy.

Share this post


Link to post
Share on other sites
Your program will have what is known as a "busy loop".
Hey, next time you're playing UT2004, drop in on the "Disasterous Consequences" server. wink.png

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!