On Wed, Nov 13, 2002 at 08:01:15PM +1300, David A. Mann wrote:
> > Anyway its ps is a shell hack that obtains stats from the proc tree and
> > dosen't show cpu usage. Ho hum. Can anyone tell me whereabouts in /proc
> > you find cpu usage?
>
> Its messy. If there is an easy way I'd love to know because I've had to
> implement it the hard way myself for the LCD project.
You cant... as Dave says, "% CPU Usage" must be done over time.
Believe it or not, Load average is a better indicator of CPU usage, but in
linux it sucks.. if you really want CPU usage:
top -b -n1 | grep "^Cpu(s):" | awk '{print $2+$4+$6}'
Of course, that is *HIDEOUSLY* specific to my top. (you want this line, or
its equivalent:
Cpu(s): 0.4% user, 0.1% system, 0.0% nice, 99.5% idle, 0.0% IO-wait
$1 $2 $3 $4 $5 $6 $7.. etc for awk fields)
Mike.
--
Michael Beattie <[EMAIL PROTECTED]>
Contentsofsignaturemaysettleduringshipping.