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.
This commit is contained in:
Alexander Motin 2013-03-23 13:11:54 +00:00
parent ca84e042a3
commit 8d2419b571
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=248647

View File

@ -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('*');