svn commit: r349118 - head/usr.sbin/iostat

Edward Tomasz Napierala trasz at FreeBSD.org
Sun Jun 16 17:32:06 UTC 2019


Author: trasz
Date: Sun Jun 16 17:32:05 2019
New Revision: 349118
URL: https://svnweb.freebsd.org/changeset/base/349118

Log:
  In iostat(8) output, skip the decimal point and the fractional part
  for tps >= 100 and MB/s >= 1000, to prevent them for widening too much.
  
  MFC after:	2 weeks

Modified:
  head/usr.sbin/iostat/iostat.c

Modified: head/usr.sbin/iostat/iostat.c
==============================================================================
--- head/usr.sbin/iostat/iostat.c	Sun Jun 16 16:45:01 2019	(r349117)
+++ head/usr.sbin/iostat/iostat.c	Sun Jun 16 17:32:05 2019	(r349118)
@@ -945,9 +945,11 @@ devstats(int perf_select, long double etime, int havel
 				       ms_per_transaction);
 		} else {
 			if (Iflag == 0)
-				printf(" %4.1Lf %4.0Lf %5.1Lf ",
+				printf(" %4.*Lf %4.0Lf %5.*Lf ",
+				       kb_per_transfer >= 100 ? 0 : 1,
 				       kb_per_transfer,
 				       transfers_per_second,
+				       mb_per_second >= 1000 ? 0 : 1,
 				       mb_per_second);
 			else {
 				total_mb = total_bytes;


More information about the svn-src-all mailing list