Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Jun 2019 17:32:05 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r349118 - head/usr.sbin/iostat
Message-ID:  <201906161732.x5GHW5Fv005941@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



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