Author: mav
Date: Sat Mar 23 13:11:54 2013
New Revision: 248647
URL: http://svnweb.freebsd.org/changeset/base/248647

Log:
  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.

Modified:
  head/usr.bin/systat/vmstat.c

Modified: head/usr.bin/systat/vmstat.c
==============================================================================
--- head/usr.bin/systat/vmstat.c        Sat Mar 23 09:06:40 2013        
(r248646)
+++ head/usr.bin/systat/vmstat.c        Sat Mar 23 13:11:54 2013        
(r248647)
@@ -703,6 +703,10 @@ putfloat(double f, int l, int lc, int w,
        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 
        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('*');
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to