summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2013-03-23 13:11:54 +0000
committermav <mav@FreeBSD.org>2013-03-23 13:11:54 +0000
commit76fe1d64637cde9dec1594afb2f8f5edcb2a3ec5 (patch)
treece3dede0fbaeb3ad1ee04f4939d1d72bcf9f1c6e
parent1c06448efc44bc696e482ef025df81d7f3853e09 (diff)
downloadFreeBSD-src-76fe1d64637cde9dec1594afb2f8f5edcb2a3ec5.zip
FreeBSD-src-76fe1d64637cde9dec1594afb2f8f5edcb2a3ec5.tar.gz
Make `systat -vmstat` to use suffixes to display big floating point numbers
that are not fitting into the specified field width, same as done for ints. In particular that allows to properly display disk tps above 100k, that are reachable with modern SSDs.
-rw-r--r--usr.bin/systat/vmstat.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/usr.bin/systat/vmstat.c b/usr.bin/systat/vmstat.c
index 856a9a6..cdb26a7 100644
--- a/usr.bin/systat/vmstat.c
+++ b/usr.bin/systat/vmstat.c
@@ -703,6 +703,10 @@ putfloat(double f, int l, int lc, int w, int d, int nz)
snr = snprintf(b, sizeof(b), "%*.*f", w, d, f);
if (snr != w)
snr = snprintf(b, sizeof(b), "%*.0f", w, f);
+ if (snr != w)
+ snr = snprintf(b, sizeof(b), "%*.0fk", w - 1, f / 1000);
+ if (snr != w)
+ snr = snprintf(b, sizeof(b), "%*.0fM", w - 1, f / 1000000);
if (snr != w) {
while (--w >= 0)
addch('*');
@@ -731,6 +735,10 @@ putlongdouble(long double f, int l, int lc, int w, int d, int nz)
snr = snprintf(b, sizeof(b), "%*.*Lf", w, d, f);
if (snr != w)
snr = snprintf(b, sizeof(b), "%*.0Lf", w, f);
+ if (snr != w)
+ snr = snprintf(b, sizeof(b), "%*.0Lfk", w - 1, f / 1000);
+ if (snr != w)
+ snr = snprintf(b, sizeof(b), "%*.0LfM", w - 1, f / 1000000);
if (snr != w) {
while (--w >= 0)
addch('*');
OpenPOWER on IntegriCloud