diff options
author | phk <phk@FreeBSD.org> | 2008-01-06 12:12:44 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2008-01-06 12:12:44 +0000 |
commit | 78269e8b8c1d1dc58c9027c22746a12ed54592cb (patch) | |
tree | 1998509af7d32787dcd34d5fec80a2109e51b0c6 /usr.sbin/gstat/gstat.c | |
parent | c72199ca0c243493a0ee361a305ff2ab325039fe (diff) | |
download | FreeBSD-src-78269e8b8c1d1dc58c9027c22746a12ed54592cb.zip FreeBSD-src-78269e8b8c1d1dc58c9027c22746a12ed54592cb.tar.gz |
When the ms/req fields exceed 1 second, drop the fractions to fit more digits.
This is unfortunately necessary with some flash based devices which can
get hundreds of seconds behind with softupdates enabled.
Diffstat (limited to 'usr.sbin/gstat/gstat.c')
-rw-r--r-- | usr.sbin/gstat/gstat.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/usr.sbin/gstat/gstat.c b/usr.sbin/gstat/gstat.c index f982235..b846c79 100644 --- a/usr.sbin/gstat/gstat.c +++ b/usr.sbin/gstat/gstat.c @@ -269,15 +269,24 @@ main(int argc, char **argv) printw(" %6.0f", (double)ld[0]); printw(" %6.0f", (double)ld[1]); printw(" %6.0f", (double)ld[2] * 1024); - printw(" %6.1f", (double)ld[3]); + if (ld[3] > 1e3) + printw(" %6.0f", (double)ld[3]); + else + printw(" %6.1f", (double)ld[3]); printw(" %6.0f", (double)ld[4]); printw(" %6.0f", (double)ld[5] * 1024); - printw(" %6.1f", (double)ld[6]); + if (ld[6] > 1e3) + printw(" %6.0f", (double)ld[6]); + else + printw(" %6.1f", (double)ld[6]); if (flag_d) { printw(" %6.0f", (double)ld[8]); printw(" %6.0f", (double)ld[9] * 1024); - printw(" %6.1f", (double)ld[10]); + if (ld[10] > 1e3) + printw(" %6.0f", (double)ld[10]); + else + printw(" %6.1f", (double)ld[10]); } if (ld[7] > 80) |