From be75dba724946a66ece8e8ed8dbee7f751ad45ff Mon Sep 17 00:00:00 2001 From: Lukas Ertl Date: Sun, 10 Oct 2004 16:13:11 +0000 Subject: [PATCH] Add an '-a' switch to only display providers that are at least 0.1% busy. OK'ed by: phk --- usr.sbin/gstat/gstat.8 | 4 +++- 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 5d482663800e..abdde06c47ed 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 c92f70ea28e2..e7bb23bce73a 100644 --- a/usr.sbin/gstat/gstat.c +++ b/usr.sbin/gstat/gstat.c @@ -47,7 +47,7 @@ #include #include -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]);