Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Dec 2005 21:16:38 GMT
From:      Robert Cousins <rec@RCousins.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/91034: minor fix to iostat so that columns line up with 128KB xfers
Message-ID:  <200512282116.jBSLGcNW059201@www.freebsd.org>
Resent-Message-ID: <200512282120.jBSLK3Hb042729@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         91034
>Category:       bin
>Synopsis:       minor fix to iostat so that columns line up with 128KB xfers
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Dec 28 21:20:03 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Robert Cousins
>Release:        6.0
>Organization:
Cousins Consulting
>Environment:
FreeBSD hammer.home.rcousins.com 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Tue Dec 13 17:37:31 PST 2005     rec@hammer.home.rcousins.com:/usr/src/sys/amd64/compile/HAMMER  amd64
            
>Description:
Iostat's output can be kind of ugly under USF2 with 128KB transfers. Here is an example:

      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.00   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 problem comes from the KB/t column which goes one character too wide.

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
        
I find this much easier to read. (A better fix would be to drop
down to 1 decimal digit for all values but I figured that would
be up to you, not me.)
>How-To-Repeat:

Run 'iostat 1' on any machine with periodic (bursty) I/O on a file system.
The results will be as shown above.
>Fix:
My fix is trivial but functional. You probably have a better way to do it.
*** old_iostat.c        Wed Dec 28 13:01:20 2005
--- iostat.c    Wed Dec 28 13:02:21 2005
***************
*** 696,707 ****
                                       msdig,
                                       ms_per_transaction);
                } else {
!                       if (Iflag == 0)
                                printf(" %5.2Lf %3.0Lf %5.2Lf ", 
                                       kb_per_transfer,
                                       transfers_per_second,
                                       mb_per_second);
!                       else {
                                total_mb = total_bytes;
                                total_mb /= 1024 * 1024;
  
--- 696,713 ----
                                       msdig,
                                       ms_per_transaction);
                } else {
!                       if (Iflag == 0) {
!                           if (kb_per_transfer < 100.)
                                printf(" %5.2Lf %3.0Lf %5.2Lf ", 
                                       kb_per_transfer,
                                       transfers_per_second,
                                       mb_per_second);
!                              else
!                               printf(" %5.1Lf %3.0Lf %5.2Lf ", 
!                                      kb_per_transfer,
!                                      transfers_per_second,
!                                      mb_per_second);
!                       } else {
                                total_mb = total_bytes;
                                total_mb /= 1024 * 1024;
  
         
>Release-Note:
>Audit-Trail:
>Unformatted:



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