aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2023-11-10 23:35:38 +0000
committerAlexander Motin <mav@FreeBSD.org>2023-11-25 00:34:19 +0000
commit7826693aa546f261edcf1c3b72755641cbc77267 (patch)
tree60aaee0fbeda2645e9f8dfb8f6c590e421ebd55f
parent3569e21f07147c8dd4bee82e5e7efe69c98edeb1 (diff)
downloadsrc-7826693aa546f261edcf1c3b72755641cbc77267.tar.gz
src-7826693aa546f261edcf1c3b72755641cbc77267.zip
iostat: Tune formatting for higher disk speeds
MFC after: 2 weeks (cherry picked from commit 105c7c4b8dcec22567a5f137b9406a95fbd9f4f2)
-rw-r--r--usr.sbin/iostat/iostat.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/usr.sbin/iostat/iostat.c b/usr.sbin/iostat/iostat.c
index d4f7a2519a1b..c6ba6aa8a7a2 100644
--- a/usr.sbin/iostat/iostat.c
+++ b/usr.sbin/iostat/iostat.c
@@ -765,9 +765,9 @@ phdr(void)
(void)printf(" blk xfr msps ");
} else {
if (Iflag == 0)
- printf(" KB/t tps MB/s ");
+ printf("KB/t tps MB/s ");
else
- printf(" KB/t xfrs MB ");
+ printf("KB/t xfrs MB ");
}
printed++;
}
@@ -934,26 +934,30 @@ devstats(int perf_select, long double etime, int havelast)
msdig,
ms_per_transaction);
else
- printf("%4.1" PRIu64 "%4.1" PRIu64 "%5.*Lf ",
+ printf("%4" PRIu64 "%4" PRIu64 "%5.*Lf ",
total_blocks,
total_transfers,
msdig,
ms_per_transaction);
} else {
if (Iflag == 0)
- printf(" %4.*Lf %4.0Lf %5.*Lf ",
+ printf("%4.*Lf %5.0Lf %5.*Lf ",
kb_per_transfer >= 100 ? 0 : 1,
kb_per_transfer,
transfers_per_second,
- mb_per_second >= 1000 ? 0 : 1,
+ mb_per_second >= 1000 ? 0 :
+ (total_mb >= 100 ? 1 : 2),
mb_per_second);
else {
total_mb = total_bytes;
total_mb /= 1024 * 1024;
- printf(" %4.1Lf %4.1" PRIu64 " %5.2Lf ",
+ printf("%4.*Lf %5" PRIu64 " %5.*Lf ",
+ kb_per_transfer >= 100 ? 0 : 1,
kb_per_transfer,
total_transfers,
+ total_mb >= 1000 ? 0 :
+ (total_mb >= 100 ? 1 : 2),
total_mb);
}
}