Jump to content
  • Advertisement
Sign in to follow this  

cpu hog!

This topic is 3786 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

I was simply wondering how do I prevent my program from becoming a cpu hog? I am using the PeekMessage method and I cannot switch to get without irritating anyone who wants to use my program. Is there a way to just limit the program to update only 30fps? Thanks for the help

Share this post


Link to post
Share on other sites
Advertisement
Well, if your app is running in the foreground, it's perfectly acceptable to use 100% of the CPU. If nothing else is using the CPU, there's no problem. You could also change your process priority if you want to, but I don't think it's really worthwhile.

In my engine, I just do a busy loop with PeekMessage(), then Render() after all messages have been processed for a frame, and if the app gets minimised, it switches to GetMessage() and no rendering.

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
You could also change your process priority if you want to, but I don't think it's really worthwhile.
I agree. I also tried this and found no real advantage. Today' scheduler is pretty smart even without those hints.

Share this post


Link to post
Share on other sites
Well I understand that you can just use a loop to physically slow down the program but it would still use 100% cpu power, and since its a 2d rpg it doesn't need that much power.

Evil Steve, I will try your method asap so thanks.

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!