cvs commit: src/usr.bin/top machine.c

Bruce Evans bde at zeta.org.au
Sun Apr 17 06:01:28 PDT 2005


On Sun, 17 Apr 2005, Giorgos Keramidas wrote:

> On 2005-04-16 21:03, Dag-Erling Sm?rgrav <des at des.no> wrote:
>> Robert Watson <rwatson at FreeBSD.org> writes:
>>> The 'C' column is quite useful when tuning SMP systems, and something
>>> I frequently look at when debugging performance issues in 5.x and
>>> 6.x.
>>
>> The C column is pointless when you're not showing individual threads,
>> since different threads in the same process might be running
>> simultaneously on different CPUs.
>
> That's probably I could manage to do later today or tomorrow.  For the
> moment, how does the following change look (change of NICE to NIC and
> removal of CPU column)?

The NICE column cannot be shrunk, because all 4 columns in it are used.
The scheduling class/base priority is encoded in the nice value, and
this gives values like -180 for ithreads...  Even more columns would be
needed to show the scheduling class completely or in a non-cryptic way.

top -S output on sledge:

%%%
last pid:  4781;  load averages:  0.00,  0.00,  0.00  up 0+22:14:00    12:19:32
89 processes:  3 running, 47 sleeping, 39 waiting

Mem: 10M Active, 537M Inact, 107M Wired, 20K Cache, 214M Buf, 7101M Free
Swap: 9216M Total, 9216M Free


   PID USERNAME    THR PRI NICE   SIZE    RES STATE  C   TIME   WCPU    CPU COMMAND
    11 root          1 171   52     0K    16K CPU1   1  22.2H 98.97% 98.97% idle
    12 root          1 171   52     0K    16K RUN    0  22.2H 98.93% 98.93% idle
    59 root          1  20    0     0K    16K syncer 1   1:07  0.00%  0.00% sync
    45 root          1 -32 -151     0K    16K WAIT   0   0:36  0.00%  0.00% swi4
     4 root          1  -8    0     0K    16K -      1   0:16  0.00%  0.00% g_do
     3 root          1  -8    0     0K    16K -      1   0:11  0.00%  0.00% g_up
    39 root          1 -68 -187     0K    16K WAIT   1   0:05  0.00%  0.00% irq2
    47 root          1 -16    0     0K    16K -      0   0:05  0.00%  0.00% yarr
    44 root          1 -44 -163     0K    16K WAIT   1   0:05  0.00%  0.00% swi1
     2 root          1  -8    0     0K    16K -      1   0:04  0.00%  0.00% g_ev
    26 root          1 -64 -183     0K    16K WAIT   1   0:04  0.00%  0.00% irq1
    57 root          1 171   52     0K    16K pgzero 0   0:04  0.00%  0.00% page
    65 root          1 -32    0     0K    16K -      1   0:03  0.00%  0.00% sche
    60 root          1  -4    0     0K    16K vlruwt 0   0:02  0.00%  0.00% vnlr
   404 root          1  96    0  7628K  2012K select 1   0:01  0.00%  0.00% ntpd
   415 daemon        1   4    0  2472K  1072K sbwait 1   0:01  0.00%  0.00% rwho
   429 root          1  96    0  9336K  3368K select 0   0:01  0.00%  0.00% send
    58 root          1 -16    0     0K    16K psleep 1   0:01  0.00%  0.00% bufd
%%%

This also shows recent severe lossage in the COMMAND column, and bogus
extra newlines after the "processes" and "Swap" rows (these only show
up in output to a file).

There used to be only 3 columns for NICE, but that broke when the priority
range was expanded from [0..127] to [0..255] in rev.1.35 of machine.c and
associated kernel changes.  Rev.1.36 of machine.c fixed this by adding a
4th column for NICE.  Before rev.1.36, "NICE" wasn't truncated to "NIC"
in the header.  The value was just in the columns under "NIC" with the
column under "E" left blank to serve as a separator.

Just removing the CPU column doesn't seem right.  ps has a -C flag to
switch between WCPU and CPU.

Bruce


More information about the cvs-src mailing list