[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Getting CPU load (from /proc/?)



On Wed, Sep 27, 2000 at 12:54:11AM -0400, Arcady Genkin wrote:
> Right.  But those are *average* values.  I'd like to be able to read
> real-time CPU load info.  For instance, if I run a CPU-intensive
> process, the value in /proc/loadavg will change very slowly.  I need
> to be able to read that CPU is 100% busy at least one second after
> this happens.

Apples and unices.  System load and CPU usage are not the same thing.  They
tend to be correlated, but certain circumstances, such as an I/O-intensive
process, can drive system load up while CPU usage stays near 0.  System load
is just that:  _system_ load.  There's more to the system than just a CPU.

Unfortunately, when I poked around in /proc, I failed to find anywhere to
read CPU usage there.  Hopefully, though, someone else will see this, realize
that load (as in load average) isn't actually what you're looking for, and
point you in the right direction.  If you really get desperate, you can look
at the source for top and see where it gets its CPU usage information from.

-- 
"Two words: Windows survives." - Craig Mundie, Microsoft senior strategist
"So does syphillis. Good thing we have penicillin." - Matthew Alton
Geek Code 3.1:  GCS d- s+: a- C++ UL++$ P+>+++ L+++>++++ E- W--(++) N+ o+
!K w---$ O M- V? PS+ PE Y+ PGP t 5++ X+ R++ tv b+ DI++++ D G e* h+ r++ y+



Reply to: