Sign in to follow this  
crazy_andy

lowering the cpu usage fo a program.

Recommended Posts

I have a c++ program that runs in the background, and it has a continuouse loop in it. However it has a cpu usage of 99% I need to check the current time approximatly every 20 seconds. How can I pause the program for this 20 secconds and then loop once and pause again etc... I need the cpu to get no higher than 2-3% really.

Share this post


Link to post
Share on other sites
Also what platform if windows, console or Win32? If you use Win32, you can actually create a timer that fires every 20 seconds, of which you can place your code to execute in there. If you have a console app, you could add in your own windows messaging loop and do the same as well.

- Drew

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this