This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Hello,
- From: Eljay Love-Jensen <eljay at adobe dot com>
- To: pchavezl <pchavezl at yahoo dot com dot mx>, gcc-help at gcc dot gnu dot org
- Date: Tue, 14 Dec 2004 10:53:53 -0600
- Subject: Re: Hello,
- References: <41BF1078.6050406@yahoo.com.mx>
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