From: Kenn Humborg (kenn at domain bluetree.ie)
Date: Mon 24 May 1999 - 21:33:00 IST
Ger Gorman wrote:
> ok, I'm trying to get the %CPU idle from a script (as in obtain its value
> ....$idle_cpu). Now my first thought was to assign the output of
> 'top -q|head -3|tail -1' to a string and strip out the value...but it is
> hardly a pleasing way to do it....top is slow to return even with the -q
> and you also have to reset your shell when the script returns as it does
> some funny things to it.....so does anyone know of a nicer way of doing
> this.....a nice system call maybe???
Or, better again:
$ cat /proc/loadavg
0.15 0.12 0.09 4/58 9540
It's easier to strip out the value from this.
Anyone know what the 4th and 5th fields are? proc(5) doesn't help.
This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:04:13 GMT