GIDForums  

Go Back   GIDForums > Computer Programming Forums > MS Visual C++ / MFC Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 09-Feb-2006, 01:38
prakhar_jack prakhar_jack is offline
New Member
 
Join Date: Feb 2006
Posts: 5
prakhar_jack is on a distinguished road

CPU Usage


Hi All,

I have a project in visual syudio.NET in the language C++.
Its an MFC application. When i m runnin the application the CPU usage reaches around 100. It should be around 50. How can i rectify this problem?

Thanks in advance!

Regards
Prakhar
  #2  
Old 10-Feb-2006, 03:34
Dominic Dominic is offline
Member
 
Join Date: Aug 2005
Posts: 123
Dominic will become famous soon enough

Re: CPU Usage


In my experience code that utilises 100% of the CPU is performing a loop. This may be intentional as in a continuous iteration loop for a game etc, or unintentional.

If your software is supposed to loop then I suggest placing a Sleep() statement in the loop. This will allow the CPU to get on with other things.

as an example, my real time simulation uses 100% CPU simply because it is in a constant loop. However, the actual time used to run the simulation is only 2.1 milliseconds. I currently use a Sleep() statement to cool the CPU during development. Note that the minimum resolution of the Sleep() command is 16 milliseconds, and the wake up is a bit jittery. When I use a Sleep() my CPU usage is only 4%..
 
 

Recent GIDBlogObservations of Iraq by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
CPU Usage prakhar_jack MS Visual C++ / MFC Forum 6 08-Feb-2006 00:05
no output, usage of sqrt and pow micheldenostra C Programming Language 3 25-Sep-2005 17:32
usage of seekg function walrus C++ Forum 2 07-May-2005 15:33
PHP/Apache memory usage issue bacchus Apache Web Server Forum 0 18-Aug-2003 12:57

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 11:39.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.