git: 7826693aa546 - stable/14 - iostat: Tune formatting for higher disk speeds
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 25 Nov 2023 00:34:26 UTC
The branch stable/14 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=7826693aa546f261edcf1c3b72755641cbc77267 commit 7826693aa546f261edcf1c3b72755641cbc77267 Author: Alexander Motin <mav@FreeBSD.org> AuthorDate: 2023-11-10 23:35:38 +0000 Commit: Alexander Motin <mav@FreeBSD.org> CommitDate: 2023-11-25 00:34:19 +0000 iostat: Tune formatting for higher disk speeds MFC after: 2 weeks (cherry picked from commit 105c7c4b8dcec22567a5f137b9406a95fbd9f4f2) --- usr.sbin/iostat/iostat.c | 16 ++++++++++------ 1 file 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); } }