From 76fe1d64637cde9dec1594afb2f8f5edcb2a3ec5 Mon Sep 17 00:00:00 2001 From: mav Date: Sat, 23 Mar 2013 13:11:54 +0000 Subject: 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. --- usr.bin/systat/vmstat.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'usr.bin') 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('*'); -- cgit v1.1