svn commit: r333945 - head/usr.bin/top

Alexey Dokuchaev danfe at FreeBSD.org
Mon May 21 06:39:54 UTC 2018


On Mon, May 21, 2018 at 10:32:30AM +1000, Bruce Evans wrote:
> ...
> > 	if (smpmode && namelength > SMPUNAMELEN)
> > 		namelength = SMPUNAMELEN;
> > 	else if (namelength > UPUNAMELEN)
> 
> But 33 is too large.  It is much larger than the hard-coded maximum limits,
> so it is never used, but is reduced to SMPNAMELEN = 13 or UPUNAMELEN = 15.
> 
> So getting the correct value of about 8 is even harder than before, but
> changing SMPNAMELEN to 4 works quite well -- "USERNAME" in the header is
> then reduced to "USER" and space is made available for something useful
> like the command name.

Big +1.  I didn't go as far as 4, but have to patch top(1) locally to use
namelength = 8 and header format so it neatly looks like this:

  PID USERNAME THR PRI NICE   SIZE    RES STATE   C   TIME    WCPU COMMAND
  844 danfe      2  21    0   114M 38836K select  0  49:39   3.82% Xorg
 5836 danfe     12  20    0   101M 23020K select  0  38:19   2.26% deadbeef

instead of our ugly, default this:

              vvvv
  PID USERNAME    THR PRI NICE   SIZE    RES STATE   C   TIME    WCPU COMMAND
41086 danfe         1  20    0 13280K  3112K CPU1    1   0:00   0.09% top
  751 root          1  20    0 10812K   596K select  2  16:53   0.03% powerd
          ^^^^^^^^^^
The amount of wasted space (shown above) is unjustified IMO.

./danfe


More information about the svn-src-head mailing list