Subject: Re: CPU states
To: None <netbsd-users@netbsd.org>
From: Jukka Salmi <j+nbsd@2006.salmi.ch>
List: netbsd-users
Date: 04/05/2006 23:34:27
Petar Bogdanovic --> netbsd-users (2006-04-05 22:31:34 +0200):
> Hi,
>
> is there another way then top(1) to get the following line?
>
> *****************************************************
> CPU states: 1.0% user, 3.9% nice, 5.9% system, 28.4% interrupt, 60.8% idle
> *****************************************************
Hmm, maybe like this:
$ sysctl -n kern.cp_time | awk -F'[, ]' '{u=$3;n=$7;s=$11;i=$15;j=$19;}END{t=u+n+s+i+j;printf "CPU states: %.1f%% user, %.1f%% nice, %.1f%% system, %.1f%% interrupt, %.1f%% idle\n",100*u/t,100*n/t,100*s/t,100*i/t,100*j/t;}'
CPU states: 3.2% user, 0.0% nice, 1.5% system, 1.8% interrupt, 93.5% idle
;-)
HTH, Jukka
--
bashian roulette:
$ ((RANDOM%6)) || rm -rf ~