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

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



David Z Maze <dmaze@MIT.EDU> writes:

> AG> How would I get a real-time CPU load information?  I found
> AG> /proc/loadavg, but that's not what I need, since it only gives average
> AG> load values.
> 
> My /proc/loadavg looks like
> 
>         0.04 0.06 0.07 3/56 959
> 
> The first three numbers are the average load over the past 1, 5, and
> 15 minutes, as is reported by 'uptime' and what not.  "3/56" means
> that three processes are currently running, out of 56 total.  "959" is 
> the pid of the last process to run, here corresponding to a 'cat'
> process.

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.
-- 
Arcady Genkin
Don't read everything you believe.



Reply to: