diff options
author | le <le@FreeBSD.org> | 2004-10-10 16:13:11 +0000 |
---|---|---|
committer | le <le@FreeBSD.org> | 2004-10-10 16:13:11 +0000 |
commit | 82d0e3bd69095f53120002933827b1a52eb7bd83 (patch) | |
tree | 237985943080ff57e53cfd87f3f519059b9ce73f /usr.sbin/gstat | |
parent | 9763558fd4083e9fc909724c6b364c4a4c42bd6b (diff) | |
download | FreeBSD-src-82d0e3bd69095f53120002933827b1a52eb7bd83.zip FreeBSD-src-82d0e3bd69095f53120002933827b1a52eb7bd83.tar.gz |
Add an '-a' switch to only display providers that are at least
0.1% busy.
OK'ed by: phk
Diffstat (limited to 'usr.sbin/gstat')
-rw-r--r-- | usr.sbin/gstat/gstat.8 | 4 | ||||
-rw-r--r-- | usr.sbin/gstat/gstat.c | 12 |
2 files changed, 13 insertions, 3 deletions
diff --git a/usr.sbin/gstat/gstat.8 b/usr.sbin/gstat/gstat.8 index 5d48266..abdde06 100644 --- a/usr.sbin/gstat/gstat.8 +++ b/usr.sbin/gstat/gstat.8 @@ -32,7 +32,7 @@ .Nd print statistics about GEOM disks .Sh SYNOPSIS .Nm -.Op Fl cd +.Op Fl acd .Op Fl I Ar interval .Sh DESCRIPTION The @@ -43,6 +43,8 @@ devices. .Pp The options are as follows: .Bl -tag -width indent +.It Fl a +Only display providers that are at least 0.1% busy. .It Fl c Enable display of .Xr geom 4 diff --git a/usr.sbin/gstat/gstat.c b/usr.sbin/gstat/gstat.c index c92f70e..e7bb23b 100644 --- a/usr.sbin/gstat/gstat.c +++ b/usr.sbin/gstat/gstat.c @@ -47,7 +47,7 @@ #include <devstat.h> #include <sys/devicestat.h> -static int flag_c, flag_d; +static int flag_a, flag_c, flag_d; static int flag_I = 500000; static void usage(void); @@ -69,8 +69,11 @@ main(int argc, char **argv) long double ld[11]; uint64_t u64; - while ((i = getopt(argc, argv, "dcI:")) != -1) { + while ((i = getopt(argc, argv, "adcI:")) != -1) { switch (i) { + case 'a': + flag_a = 1; + break; case 'c': flag_c = 1; break; @@ -187,6 +190,11 @@ main(int argc, char **argv) DSM_MS_PER_TRANSACTION_FREE, &ld[10], DSM_NONE); + if (flag_a && ld[7] < 0.1) { + *gsq = *gsp; + continue; + } + printw(" %4ju", (uintmax_t)u64); printw(" %6.0f", (double)ld[0]); printw(" %6.0f", (double)ld[1]); |