From nobody@FreeBSD.org  Wed Aug 14 17:04:45 2002
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 4F37E37B400
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 14 Aug 2002 17:04:45 -0700 (PDT)
Received: from www.freebsd.org (www.FreeBSD.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 1064143E65
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 14 Aug 2002 17:04:45 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.4/8.12.4) with ESMTP id g7F04ZOT057148
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 14 Aug 2002 17:04:35 -0700 (PDT)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.4/8.12.4/Submit) id g7F04ZAI057147;
	Wed, 14 Aug 2002 17:04:35 -0700 (PDT)
Message-Id: <200208150004.g7F04ZAI057147@www.freebsd.org>
Date: Wed, 14 Aug 2002 17:04:35 -0700 (PDT)
From: Aragon Gouveia <aragon@phat.za.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: iostat column formatting overlaps
X-Send-Pr-Version: www-1.0

>Number:         41674
>Category:       bin
>Synopsis:       [patch] iostat(8) column formatting overlaps
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 14 17:10:02 PDT 2002
>Closed-Date:    Thu Apr 29 13:37:45 UTC 2010
>Last-Modified:  Thu Apr 29 13:37:45 UTC 2010
>Originator:     Aragon Gouveia
>Release:        4.6-STABLE
>Organization:
>Environment:
FreeBSD host.fqdn.org 4.6-STABLE FreeBSD 4.6-STABLE #0: Thu Aug  8 23:39:11 SAST 2002     root@host.fqdn.org:/usr/src/sys/compile/KERN  i386
>Description:
      When iostat outputs CPU usage values, columns are too narrow to accomodate 100%. For example:

 tin tout  KB/t tps  MB/s   KB/t tps  MB/s  us ni sy in id
  68  103  0.00   0  0.00   0.00   0  0.00   0  0  0  0100
   0  319  0.00   0  0.00   0.00   0  0.00   0  0  0  0100

Making it both slightly confusing to read, and a nightmare to accurately text process.

>How-To-Repeat:

>Fix:
Simple reformatting. Diff available from http://decoder.geek.sh/iostat.aragon.diff and also follows below :


--- iostat.c    Thu Jul 19 06:15:42 2001
+++ iostat.c.new        Thu Aug 15 01:43:07 2002
@@ -551,7 +551,7 @@
                }
        }
        if ((dflag == 0) || (Cflag > 0))
-               (void)printf("            cpu\n");
+               (void)printf("                           cpu\n");
        else
                (void)printf("\n");
 
@@ -576,7 +576,7 @@
                }
        }
        if ((dflag == 0) || (Cflag > 0))
-               (void)printf(" us ni sy in id\n");
+               (void)printf("    us    ni    sy    in    id\n");
        else
                printf("\n");
 
@@ -674,6 +674,6 @@
        for (state = 0; state < CPUSTATES; ++state)
                time += cur.cp_time[state];
        for (state = 0; state < CPUSTATES; ++state)
-               printf("%3.0f",
+               printf("%6.1f",
                       100. * cur.cp_time[state] / (time ? time : 1));
 }
>Release-Note:
>Audit-Trail:

From: Bruce Evans <bde@zeta.org.au>
To: Aragon Gouveia <aragon@phat.za.net>
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: misc/41674: iostat column formatting overlaps
Date: Thu, 15 Aug 2002 18:43:30 +1000 (EST)

 On Wed, 14 Aug 2002, Aragon Gouveia wrote:
 
 > >Description:
 >       When iostat outputs CPU usage values, columns are too narrow to accomodate 100%. For example:
 >
 >  tin tout  KB/t tps  MB/s   KB/t tps  MB/s  us ni sy in id
 >   68  103  0.00   0  0.00   0.00   0  0.00   0  0  0  0100
 >    0  319  0.00   0  0.00   0.00   0  0.00   0  0  0  0100
 >
 > Making it both slightly confusing to read, and a nightmare to accurately text process.
 >
 > >How-To-Repeat:
 >
 > >Fix:
 > Simple reformatting. Diff available from http://decoder.geek.sh/iostat.aragon.diff and also follows below :
 >
 >
 > --- iostat.c    Thu Jul 19 06:15:42 2001
 > +++ iostat.c.new        Thu Aug 15 01:43:07 2002
 > @@ -551,7 +551,7 @@
 >                 }
 >         }
 >         if ((dflag == 0) || (Cflag > 0))
 > -               (void)printf("            cpu\n");
 > +               (void)printf("                           cpu\n");
 >         else
 >                 (void)printf("\n");
 >
 > @@ -576,7 +576,7 @@
 >                 }
 >         }
 >         if ((dflag == 0) || (Cflag > 0))
 > -               (void)printf(" us ni sy in id\n");
 > +               (void)printf("    us    ni    sy    in    id\n");
 >         else
 >                 printf("\n");
 >
 > @@ -674,6 +674,6 @@
 >         for (state = 0; state < CPUSTATES; ++state)
 >                 time += cur.cp_time[state];
 >         for (state = 0; state < CPUSTATES; ++state)
 > -               printf("%3.0f",
 > +               printf("%6.1f",
 >                        100. * cur.cp_time[state] / (time ? time : 1));
 >  }
 
 This makes it a nightmare to read on 80-column terminals.  The number of
 devices shown by default would have to be reduced from 3 to only 2 to
 reduce the line length to less than 80 columns again.
 
 Printing more precision might confuse parsers that expect plain integers,
 especially if they know that the integers are formatted in 3 characters,
 as they probably have to do to parse the run together digits.
 
 Bruce
 

From: Aragon Gouveia <aragon@phat.za.net>
To: Bruce Evans <bde@zeta.org.au>
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: misc/41674: iostat column formatting overlaps
Date: Thu, 15 Aug 2002 11:17:06 +0200

 | By Bruce Evans <bde@zeta.org.au>
 |                                          [ 2002-08-15 10:37 +0200 ]
 > This makes it a nightmare to read on 80-column terminals.  The number of
 > devices shown by default would have to be reduced from 3 to only 2 to
 > reduce the line length to less than 80 columns again.
 > 
 > Printing more precision might confuse parsers that expect plain integers,
 > especially if they know that the integers are formatted in 3 characters,
 > as they probably have to do to parse the run together digits.
 
 Ok understandable. I think the column spacing should atleast be increased a
 notch to accomodate "100" without overlapping with a value next to it.
 
 I didn't intend to include the precision change in my diff - that kinda
 slipped in by accident because I use it. I don't think it's necessary
 either, but would be a nice option to enable on the command line.
 
 Will %4.0f still be too big for 80 column terms?
 
 
 Thanks,
 Aragon

From: Bruce Evans <bde@zeta.org.au>
To: Aragon Gouveia <aragon@phat.za.net>
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: misc/41674: iostat column formatting overlaps
Date: Fri, 16 Aug 2002 04:08:54 +1000 (EST)

 On Thu, 15 Aug 2002, Aragon Gouveia wrote:
 
 > | By Bruce Evans <bde@zeta.org.au>
 > |                                          [ 2002-08-15 10:37 +0200 ]
 > > This makes it a nightmare to read on 80-column terminals.  The number of
 > > devices shown by default would have to be reduced from 3 to only 2 to
 > > reduce the line length to less than 80 columns again.
 > >
 > > Printing more precision might confuse parsers that expect plain integers,
 > > especially if they know that the integers are formatted in 3 characters,
 > > as they probably have to do to parse the run together digits.
 >
 > Ok understandable. I think the column spacing should atleast be increased a
 > notch to accomodate "100" without overlapping with a value next to it.
 >
 > I didn't intend to include the precision change in my diff - that kinda
 > slipped in by accident because I use it. I don't think it's necessary
 > either, but would be a nice option to enable on the command line.
 >
 > Will %4.0f still be too big for 80 column terms?
 
 It takes 80 exactly, which is 1 too many after line wrap.  I suggest using
 almost the same method as in vmstat: " %2.0f" always leaves a space and
 usually has the same effect as "%3.0f".  (vmstat uses "%2.0f " except for
 the last field it uses "%2.0f".)
 
 %%%
 Index: iostat.c
 ===================================================================
 RCS file: /home/ncvs/src/usr.sbin/iostat/iostat.c,v
 retrieving revision 1.23
 diff -u -2 -r1.23 iostat.c
 --- iostat.c	26 Sep 2001 19:35:03 -0000	1.23
 +++ iostat.c	15 Aug 2002 17:55:10 -0000
 @@ -727,5 +728,5 @@
  		time += cur.cp_time[state];
  	for (state = 0; state < CPUSTATES; ++state)
 -		printf("%3.0f",
 +		printf(" %2.0f",
  		       rint(100. * cur.cp_time[state] / (time ? time : 1)));
  }
 %%%
 
 Bruce
 

From: Aragon Gouveia <aragon@phat.za.net>
To: Bruce Evans <bde@zeta.org.au>
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: misc/41674: iostat column formatting overlaps
Date: Thu, 15 Aug 2002 20:18:15 +0200

 Perfect. :)
 
 
 | By Bruce Evans <bde@zeta.org.au>
 |                                          [ 2002-08-15 20:02 +0200 ]
 > On Thu, 15 Aug 2002, Aragon Gouveia wrote:
 > 
 > > | By Bruce Evans <bde@zeta.org.au>
 > > |                                          [ 2002-08-15 10:37 +0200 ]
 > > > This makes it a nightmare to read on 80-column terminals.  The number of
 > > > devices shown by default would have to be reduced from 3 to only 2 to
 > > > reduce the line length to less than 80 columns again.
 > > >
 > > > Printing more precision might confuse parsers that expect plain integers,
 > > > especially if they know that the integers are formatted in 3 characters,
 > > > as they probably have to do to parse the run together digits.
 > >
 > > Ok understandable. I think the column spacing should atleast be increased a
 > > notch to accomodate "100" without overlapping with a value next to it.
 > >
 > > I didn't intend to include the precision change in my diff - that kinda
 > > slipped in by accident because I use it. I don't think it's necessary
 > > either, but would be a nice option to enable on the command line.
 > >
 > > Will %4.0f still be too big for 80 column terms?
 > 
 > It takes 80 exactly, which is 1 too many after line wrap.  I suggest using
 > almost the same method as in vmstat: " %2.0f" always leaves a space and
 > usually has the same effect as "%3.0f".  (vmstat uses "%2.0f " except for
 > the last field it uses "%2.0f".)
 > 
 > %%%
 > Index: iostat.c
 > ===================================================================
 > RCS file: /home/ncvs/src/usr.sbin/iostat/iostat.c,v
 > retrieving revision 1.23
 > diff -u -2 -r1.23 iostat.c
 > --- iostat.c	26 Sep 2001 19:35:03 -0000	1.23
 > +++ iostat.c	15 Aug 2002 17:55:10 -0000
 > @@ -727,5 +728,5 @@
 >  		time += cur.cp_time[state];
 >  	for (state = 0; state < CPUSTATES; ++state)
 > -		printf("%3.0f",
 > +		printf(" %2.0f",
 >  		       rint(100. * cur.cp_time[state] / (time ? time : 1)));
 >  }
 > %%%
 > 
 > Bruce
 > 

From: Bruce Evans <bde@zeta.org.au>
To: Aragon Gouveia <aragon@phat.za.net>
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: misc/41674: iostat column formatting overlaps
Date: Fri, 16 Aug 2002 23:09:49 +1000 (EST)

 On Thu, 15 Aug 2002, Aragon Gouveia wrote:
 
 > Perfect. :)
 
 > > Index: iostat.c
 > > ...
 > > -		printf("%3.0f",
 > > +		printf(" %2.0f",
 
 OK; I will commit this version.
 
 Bruce
 
Responsible-Changed-From-To: freebsd-bugs->ken 
Responsible-Changed-By: kris 
Responsible-Changed-When: Fri Jul 18 15:07:24 PDT 2003 
Responsible-Changed-Why:  
Assign to iostat maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=41674 
Responsible-Changed-From-To: ken->freebsd-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Aug 2 00:39:53 UTC 2007 
Responsible-Changed-Why:  
With permission, reassign away from inactive committer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=41674 

From: Alexander Best <alexbestms@wwu.de>
To: <bug-followup@FreeBSD.org>
Cc: Aragon Gouveia <aragon@phat.za.net>
Subject: Re: bin/41674: [patch] iostat(8) column formatting overlaps
Date: Wed, 28 Apr 2010 14:51:57 +0200 (CEST)

 this problem should no longer occur since all cpu fields (us, ni, sy, in and
 id) are now only " %2.0f" wide.
 
 this fix got committed by bde@ in 2002 with r102068. ;) it's in all branches
 >= stable4.
 
 -- 
 Alexander Best

From: Aragon Gouveia <aragon@phat.za.net>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/41674: [patch] iostat(8) column formatting overlaps
Date: Thu, 29 Apr 2010 14:24:48 +0200

 This is fixed in 8.0 for me.  I'm sure this can be closed. :)
 
 Thanks
State-Changed-From-To: open->closed 
State-Changed-By: remko 
State-Changed-When: Thu Apr 29 13:37:33 UTC 2010 
State-Changed-Why:  
Apparently this can be closed, make this happen :) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=41674 
>Unformatted:
