Hello,

Eljay Love-Jensen eljay@adobe.com
Tue Dec 14 16:53:00 GMT 2004


Hi Pedro,

This is not the correct forum for your question, as it is off-topic from 
GCC issues & questions.

For multitasking OS's (pretty much all modern OS's), to use "spare cycles" 
from the CPU, just make sure your background application is running at a 
lower priority than other processes (but one step higher priority than the 
"idle CPU" process!).

If you really want to understand CPU cycles and load, use Google to find 
pages that describe the "uptime" command, "load average" and the three load 
numbers (1, 5 and 15 minute loads).  Get the source code for uptime, and 
use the same logic it uses.

Here's one such page:
http://www.luv.asn.au/overheads/NJG_LUV_2002/luvSlides.html

If you want a quick-and-dirty hack, periodically (once a minute?) run 
uptime, and scrape out the first load number.

HTH,
--Eljay



More information about the Gcc-help mailing list