Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Aug 2006 14:32:18 +1000 (EST)
From:      Ian Smith <smithi@nimnet.asn.au>
To:        questions@freebsd.org
Subject:   Top not showing cpu usage even remotely accurately
Message-ID:  <Pine.BSF.3.96.1060810135055.16843A-100000@gaia.nimnet.asn.au>

next in thread | raw e-mail | index | archive | help
In the past (FreeBSD 2.2, 3.3, 4.5 through 4.10) if I noticed unexpected
high cpu use, say on xload or ascpu, I'd just run top to determine what
the pig was, and kill it if something (usually netscape :) was wedged.

But since running 5.x (5.5-STABLE since 1st Aug) top can show 0.0% idle
but the cpu usages shown don't add up to much of a fraction of 100%.

For a typical illustration: 'make index' has been running for hours, and
here's a shot of 'nice top', o)rdered by cpu, showing S)ystem procs: 

last pid: 62397;  load averages:  2.06,  2.09,  2.13      up 3+03:57:39 13:11:27
154 processes: 6 running, 125 sleeping, 23 waiting
CPU states: 77.3% user,  0.0% nice, 22.7% system,  0.0% interrupt,  0.0% idle
Mem: 79M Active, 24M Inact, 37M Wired, 5640K Cache, 25M Buf, 3388K Free
Swap: 384M Total, 133M Used, 251M Free, 34% Inuse

  PID USERNAME PRI NICE   SIZE    RES STATE    TIME   WCPU    CPU COMMAND
62380 root     122    0   788K   648K RUN      0:01 19.48%  1.86% make
  736 smithi    97    0 27000K  3184K select  89:56  1.07%  1.07% kdeinit
  762 smithi    96    0 29708K  7428K select  14:01  0.93%  0.93% kdeinit
  699 smithi    96    0 52320K 10288K select 105:02  0.88%  0.88% Xorg
62394 root     125    0   580K   440K RUN      0:00  7.00%  0.34% make
  754 smithi    96    0 30972K  6308K select  57:22  0.15%  0.15% kdeinit
  770 smithi     8    0  2524K   660K nanslp  20:51  0.05%  0.05% ascpu
   11 root     171   52     0K     8K RUN     60.4H  0.00%  0.00% idle
  760 smithi    20    0 10636K  1404K kserel 187:08  0.00%  0.00% xmms
   27 root     -28 -147     0K     8K RUN     27:50  0.00%  0.00% swi5: clock sio
  757 smithi    96    0 28784K  4220K select  26:03  0.00%  0.00% kdeinit
  767 smithi    96    0 29828K  5704K select  24:01  0.00%  0.00% kdeinit
28643 smithi    20    0 71016K 30816K kserel  23:01  0.00%  0.00% mozilla-bin
  769 smithi     8    0  2300K   612K nanslp  21:23  0.00%  0.00% asapm
  639 root      96    0  1244K   364K select  17:02  0.00%  0.00% moused
  761 smithi    96    0 29468K  5132K select  16:32  0.00%  0.00% kdeinit
  763 smithi    96    0 36568K  5940K select  13:06  0.00%  0.00% kdeinit
  619 mysql     20    0 49800K  1528K kserel  12:27  0.00%  0.00% mysqld
  752 smithi    96    0 29644K  4976K select  10:59  0.00%  0.00% kdeinit
  759 smithi    96    0 28720K  4548K select   9:34  0.00%  0.00% kdeinit
15822 smithi     8    0  1488K   412K nanslp   4:30  0.00%  0.00% ephem
  750 smithi    96    0 27304K  5316K select   3:03  0.00%  0.00% kdeinit
    4 root      -8    0     0K     8K -        1:50  0.00%  0.00% g_down
   23 root     -60 -179     0K     8K WAIT     1:31  0.00%  0.00% irq12: psm0
    3 root      -8    0     0K     8K -        1:30  0.00%  0.00% g_up
   43 root      20    0     0K     8K syncer   1:28  0.00%  0.00% syncer
   49 root      12    0     0K     8K -        1:16  0.00%  0.00% schedcpu
   30 root     -16    0     0K     8K -        1:06  0.00%  0.00% yarrow
   39 root     -16    0     0K     8K psleep   0:56  0.00%  0.00% pagedaemon
   16 root     -80 -199     0K     8K WAIT     0:48  0.00%  0.00% irq5: sbc0
    2 root      -8    0     0K     8K -        0:48  0.00%  0.00% g_event
   41 root     171   52     0K     8K RUN      0:46  0.00%  0.00% pagezero
   29 root     -44 -163     0K     8K WAIT     0:26  0.00%  0.00% swi1: net
  545 root      96    0  9764K   492K select   0:21  0.00%  0.00% httpd
   25 root     -64 -183     0K     8K WAIT     0:21  0.00%  0.00% irq14: ata0
   13 root     -60 -179     0K     8K WAIT     0:18  0.00%  0.00% irq1: atkbd0
  490 root      96    0  3464K   744K select   0:17  0.00%  0.00% sendmail
[etc]

'ps auxww' cpu percentages reveal little more, except that make index is
running 'make -j2 ..' hence the ~2.0 load average.

Ignore the high swap use; most of it is numerous quiescent kwrite, httpd
and mozilla sessions pushed out to swap on this lil' 160MB laptop;
'systat -vm' shows it's not actually doing any paging during this time.

Any ideas why top hasn't much of a clue about what's consuming cpu? 

Cheers, Ian




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.1060810135055.16843A-100000>