git: f61939970fae - stable/13 - iostat: fix rounding errors in iostat -x

Alan Somers asomers at FreeBSD.org
Sun Aug 22 21:23:49 UTC 2021


The branch stable/13 has been updated by asomers:

URL: https://cgit.FreeBSD.org/src/commit/?id=f61939970fae21a118bffa8794d8dcc65aed5372

commit f61939970fae21a118bffa8794d8dcc65aed5372
Author:     Alan Somers <asomers at FreeBSD.org>
AuthorDate: 2021-07-08 16:16:32 +0000
Commit:     Alan Somers <asomers at FreeBSD.org>
CommitDate: 2021-08-22 21:23:23 +0000

    iostat: fix rounding errors in iostat -x
    
    Better to round numbers instead of flooring them.
    
    Sponsored by:   Axcient
    
    (cherry picked from commit 61631b24a1347a23cafe0657fba894622b1606e2)
---
 usr.sbin/iostat/iostat.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/usr.sbin/iostat/iostat.c b/usr.sbin/iostat/iostat.c
index 4cbfcfcbcbd5..9140bf10ef07 100644
--- a/usr.sbin/iostat/iostat.c
+++ b/usr.sbin/iostat/iostat.c
@@ -888,17 +888,17 @@ devstats(int perf_select, long double etime, int havelast)
 			    mb_per_second_write > ((long double).0005)/1024 ||
 			    busy_pct > 0.5) {
 				if (Iflag == 0)
-					printf("%-8.8s %7d %7d %8.1Lf "
-					    "%8.1Lf %5d %5d %5d %5d "
-					    "%4" PRIu64 " %3.0Lf ",
+					printf("%-8.8s %7.0Lf %7.0Lf %8.1Lf "
+					    "%8.1Lf %5.0Lf %5.0Lf %5.0Lf %5.0Lf"
+					    " %4" PRIu64 " %3.0Lf ",
 					    devicename,
-					    (int)transfers_per_second_read,
-					    (int)transfers_per_second_write,
+					    transfers_per_second_read,
+					    transfers_per_second_write,
 					    mb_per_second_read * 1024,
 					    mb_per_second_write * 1024,
-					    (int)ms_per_read, (int)ms_per_write,
-					    (int)ms_per_other,
-					    (int)ms_per_transaction,
+					    ms_per_read, ms_per_write,
+					    ms_per_other,
+					    ms_per_transaction,
 					    queue_len, busy_pct);
 				else
 					printf("%-8.8s %11.1Lf %11.1Lf "


More information about the dev-commits-src-branches mailing list