'top' shows wrong CPU usage

Lowell Gilbert freebsd-questions-local at be-well.ilk.org
Wed Jan 21 13:01:34 PST 2009


KES <kes-kes at yandex.ru> writes:

> top shows often nonsense in CPU usage of a process, but totals are OK
> and it seems that WCPU and CPU has no differences in results

Why do you think it's nonsense?  It's averaged over a different time
period than the "CPU:" line in the header, so I wouldn't expect it to
match... 

> top -S
> last pid: 66182;  load averages:  2.51,  2.15,  2.03             up 10+23:40:14  22:05:41
> 798 processes: 6 running, 772 sleeping, 1 zombie, 18 waiting, 1 lock
> CPU:  4.4% user,  0.0% nice, 14.8% system, 16.7% interrupt, 64.0% idle
> Mem: 264M Active, 60M Inact, 147M Wired, 6968K Cache, 60M Buf, 9888K Free
> Swap: 2048M Total, 1903M Used, 145M Free, 92% Inuse
>
>   PID USERNAME    THR PRI NICE   SIZE    RES STATE    TIME   WCPU COMMAND
>    11 root          1 171 ki31     0K     8K RUN    104.1H 88.48% idle: cpu0
> 66178 firebird      1  49    0 23120K  5828K select   0:00  1.37% fb_inet_server
> 66159 firebird      1  48    0 23120K  5760K select   0:01  1.17% fb_inet_server
>  5156 root          1  44    0  9024K   544K select  57:39  0.68% snmpd
> 66182 root          1  44    0  4556K  2608K RUN      0:00  0.68% top
> 66147 root          1   8    0  3124K   840K nanslp   0:00  0.59% monitord
> 66138 firebird      1  44    0 23120K  5736K select   0:01  0.49% fb_inet_server
> 75745 www           1  44    0 24628K  9500K select   5:05  0.29% python2.5
> 66180 firebird      1  46    0 23120K  5852K select   0:00  0.10% fb_inet_server
>
>
> #top -S -C
> last pid: 66209;  load averages:  2.13,  2.10,  2.02             up 10+23:41:07  22:06:34
> 814 processes: 6 running, 788 sleeping, 1 zombie, 18 waiting, 1 lock
> CPU:  9.3% user,  0.0% nice, 13.4% system, 12.8% interrupt, 64.5% idle
> Mem: 269M Active, 56M Inact, 148M Wired, 12M Cache, 60M Buf, 3700K Free
> Swap: 2048M Total, 1903M Used, 145M Free, 92% Inuse
>
>   PID USERNAME    THR PRI NICE   SIZE    RES STATE    TIME    CPU COMMAND
>    11 root          1 171 ki31     0K     8K RUN    104.1H 92.29% idle: cpu0
> 66138 firebird      1  49    0 23120K  5556K select   0:01  1.46% fb_inet_server
> 66180 firebird      1  44    0 23120K  5612K select   0:01  0.59% fb_inet_server
> 66209 root          1  44    0  4556K  2556K RUN      0:00  0.59% top
> 66179 firebird      1  44    0 23120K  5624K select   0:01  0.49% fb_inet_server
>  5156 root          1  44    0  9024K   544K select  57:39  0.39% snmpd
> 66147 root          1   8    0  3124K   840K nanslp   0:01  0.39% monitord
> 66178 firebird      1  44    0 23120K  5584K select   0:01  0.20% fb_inet_server
>    12 root          1 -44    -     0K     8K WAIT   126.8H  0.00% swi1: net
>    42 root          1 -68    -     0K     8K -      219:53  0.00% dummynet

-- 
Lowell Gilbert, embedded/networking software engineer, Boston area
		http://be-well.ilk.org/~lowell/


More information about the freebsd-questions mailing list