Date: Thu, 15 Aug 2002 01:40:04 -0700 (PDT) From: Bruce Evans <bde@zeta.org.au> To: freebsd-bugs@FreeBSD.org Subject: Re: misc/41674: iostat column formatting overlaps Message-ID: <200208150840.g7F8e4hU065511@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR misc/41674; it has been noted by GNATS. 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 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208150840.g7F8e4hU065511>