bin/91034: minor fix to iostat so that columns line up with 128KB xfers

Giorgos Keramidas keramida at ceid.upatras.gr
Tue Jan 3 13:50:10 PST 2006


The following reply was made to PR bin/91034; it has been noted by GNATS.

From: Giorgos Keramidas <keramida at ceid.upatras.gr>
To: Bruce Evans <bde at zeta.org.au>
Cc: bug-followup at FreeBSD.org
Subject: Re: bin/91034: minor fix to iostat so that columns line up with 128KB xfers
Date: Tue, 3 Jan 2006 23:46:52 +0200

 On 2006-01-03 22:40, Bruce Evans <bde at zeta.org.au> wrote:
 >On Tue, 3 Jan 2006, Giorgos Keramidas wrote:
 >>On 2005-12-28 21:16, Robert Cousins <rec at RCousins.com> wrote:
 >>> Iostat's output can be kind of ugly under USF2 with 128KB
 >>> transfers. Here is an example:
 >>> ...
 >>> The patch I'm submitting notices when this value is >= 100 and
 >>> drops from 2 decimals to 1 in this case. The result is an output
 >>> like this:
 >>>
 >>>       tty             ad0              ad1             cpu
 >>>  tin tout  KB/t tps  MB/s   KB/t tps  MB/s  us ni sy in id
 >>>    0   60  0.00   0  0.00   0.00   0  0.00  50  0  0  0 50
 >>>    0  180  0.00   0  0.00  128.0   8  1.00  48  0  0  0 51
 >>>    0   61  0.00   0  0.00   0.00   0  0.00  50  0  0  0 50
 >>>    0   60  0.00   0  0.00   0.00   0  0.00  49  0  0  0 51
 >>
 >> The misaligned dots seem a bit ugly.
 >
 > Indeed.  They are like the -h (hideous or human-unreadable) output
 > in many utilities.  Exponential notation and columns that aren't
 > lined up are hard for humans to read.
 >
 > >Is it ok to use %6.2Lf as
 > >the format specifier, widening the KB columns a bit to fit the
 > >new length of the text?
 >
 > No.  There is space in the above, but most systems have more than 2 drives
 > (most of mine have 6, with 4 physical drives and extras from atapicam
 > duplicating acd0 and cam giving a virtual drive pass0).  Info about 3
 > drives just fits in 80 columns with %5.2Lf format.  It results in 77
 > coumns being used.  %6.2Lf format would result in 80 columns being used
 > and thus ugly line wrap on some terminals (or the number of drives being
 > limited to 2).
 
 So, there's no way to keep the pretty format of current iostat output
 *and* account for larger transfer speeds? :-(
 
 Looking at an awk-formatted version of the iostat output it seems that
 even with 3 disks we *do* hae 3 columns to spare until 79 columns are
 reached:
 
 $ iostat ad0 da0 pass0 | awk '{printf "%-78s|\n",$0}'
       tty             ad0              da0            pass0             cpu   |
  tin tout  KB/t tps  MB/s   KB/t tps  MB/s   KB/t tps  MB/s  us ni sy in id   |
   63  514  7.10  13  0.09   0.01   0  0.00   0.00   0  0.00   1  0  2  0 96   |
 $
 
 Is this enough for adding an extra column to every KB/t column and
 still keeping everything under 80 columns?
 


More information about the freebsd-bugs mailing list