Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Aug 2006 23:06:49 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Giorgos Keramidas <keramida@ceid.upatras.gr>
Cc:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/101975: [PATCH] Adding percents in /usr/src/usr.bin/systat/pigs.c
Message-ID:  <20060816225021.R37670@delplex.bde.org>
In-Reply-To: <200608151230.k7FCUNf3014171@freefall.freebsd.org>
References:  <200608151230.k7FCUNf3014171@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
[Private reply]

Hi Giorgos,

> On 2006-08-14 14:54, bsd@forbrazil.com.br wrote:
> > Sorry, but i'm only based in 'systat -swaps', where shows it:
> > Disk 1K-blocks     Used  /0%  /10% /20% /30% /40% /50% /60% /70% /80% /90% /100%
> > ad0s1  8388480     1076  X
>
> There is no % after 100 in "systat -swap".  Precisely because all those
> % characters push the line length up to almost 80 characters and this
> would overflow 80x25 terminal lines.

The truncation seems to depend on whether swap is configured.  With
no swap configured, the display is a mess and looks like "...10\n0<garbage>.
It looks like it started with 100% and truncated to 100 but was still
too long so the line wrapped.  I suspect that it truncates at 80 columns
and wraps at 79 columns.  With 1 swap device configured, this display
is less of a mess and looks like "...10\n<non-garbage>.  I suspect
that it still mistruncates and wraps, but the line for the first swap
device starts at column 1 and overwrites the garbage.

It seems unlikely that the scale is correct with the %'s expanding things.
It's hard to tell -- I never use swap on systems with more than 64MB of
memory, and most systems have lots of swap and use epsilon% of it.

> I'm not sure it's worth repeating the same 'hack' in other screens, but
> I'd certainly prefer any of:
>
> Disk 1K-blocks     Used  /0  /10 /20 /30 /40 /50 /60 /70 /80 /90 /100%
> Disk 1K-blocks     Used  /0% /10 /20 /30 /40 /50 /60 /70 /80 /90 /100

% at the end looks good.  Some other displays use "%foo N1...Nk" instead of
foo "N1%...Nk%" to save space.

Looking at the pigs display reminded me that it shows bogus idle
percentages.  On an idle machine with N CPUs, after warming up it shows
<idle> taking about 100/(N+1)% and N idle threads also taking 100/(N+1)%.
top -S shows the idle threads correctly as taking almost 100%.  I think
the problem is that it doesn't understand the per-cpu idle thread.  It
might also not understand idle priority threads.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060816225021.R37670>