Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 May 2006 17:55:30 +0200
From:      Ulrich Spoerlein <uspoerlein@gmail.com>
To:        current@freebsd.org
Subject:   iostat column width display
Message-ID:  <20060514155530.GA3247@roadrunner.informatik.uni-wuerzburg.de>

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

--uZ3hkaAS1mZxFaxD
Content-Type: multipart/mixed; boundary="45Z9DzgjV8m4Oswq"
Content-Disposition: inline


--45Z9DzgjV8m4Oswq
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hello all,

the column widths in iostat(1) output are not spaced correctly.

      tty             ad0              da0              cd0             cpu
 tin tout  KB/t tps  MB/s   KB/t tps  MB/s   KB/t tps  MB/s  us ni sy in id
  14  170  0.00   0  0.00  128.00 202 25.23   0.00   0  0.00   2  0 10  6 82
  15  324  0.00   0  0.00  128.00 202 25.23   0.00   0  0.00   2  0  0  5 94

KB/t > 100 make the display overflow. KB/t is not helpful anyway,
because '1.00' is of width 4, whereas '1024' (bytes) would be of width 4
too. So either cut it down to '1.0' or just use the byte count anyway.

Proposed patch is attached. It simply changes the display to %5.1f, an
alternative would be to remove the additional spaces between different
devices.

Ulrich Spoerlein

PS: This still sucks, as transfer rates above 100MB/s will make the
display overflow again :(
--=20
 PGP Key ID: 20FEE9DD				Encrypted mail welcome!
Fingerprint: AEC9 AF5E 01AC 4EE1 8F70  6CBD E76E 2227 20FE E9DD
Which is worse: ignorance or apathy?
Don't know. Don't care.

--45Z9DzgjV8m4Oswq
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch
Content-Transfer-Encoding: quoted-printable

--- iostat.c	Sun May 14 17:48:29 2006
+++ iostat.c.orig	Sat Mar 15 22:59:06 2003
@@ -697,7 +697,7 @@
 				       ms_per_transaction);
 		} else {
 			if (Iflag =3D=3D 0)
-				printf(" %5.1Lf %3.0Lf %5.2Lf ",=20
+				printf(" %5.2Lf %3.0Lf %5.2Lf ",=20
 				       kb_per_transfer,
 				       transfers_per_second,
 				       mb_per_second);
@@ -705,7 +705,7 @@
 				total_mb =3D total_bytes;
 				total_mb /=3D 1024 * 1024;
=20
-				printf(" %5.1Lf %3.1qu %5.2Lf ",=20
+				printf(" %5.2Lf %3.1qu %5.2Lf ",=20
 				       kb_per_transfer,
 				       total_transfers,
 				       total_mb);

--45Z9DzgjV8m4Oswq--

--uZ3hkaAS1mZxFaxD
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (FreeBSD)

iD8DBQFEZ1Ly524iJyD+6d0RAqjvAJ0dK0hSe48ZXpMyAUaU80UI+6OnGQCfWop8
Nx7btbYoSkzfSKrhPLIgIJI=
=453w
-----END PGP SIGNATURE-----

--uZ3hkaAS1mZxFaxD--



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