aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorLukas Ertl <le@FreeBSD.org>2004-10-10 16:13:11 +0000
committerLukas Ertl <le@FreeBSD.org>2004-10-10 16:13:11 +0000
commitbe75dba724946a66ece8e8ed8dbee7f751ad45ff (patch)
tree237985943080ff57e53cfd87f3f519059b9ce73f /usr.sbin
parent00bd8f10be12959d857252e985d534a0abae1768 (diff)
downloadsrc-be75dba724946a66ece8e8ed8dbee7f751ad45ff.tar.gz
src-be75dba724946a66ece8e8ed8dbee7f751ad45ff.zip
Add an '-a' switch to only display providers that are at least
0.1% busy. OK'ed by: phk
Notes
Notes: svn path=/head/; revision=136354
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/gstat/gstat.84
-rw-r--r--usr.sbin/gstat/gstat.c12
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 <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]);