summaryrefslogtreecommitdiffstats
path: root/usr.sbin/gstat
diff options
context:
space:
mode:
authorsjg <sjg@FreeBSD.org>2014-08-19 06:50:54 +0000
committersjg <sjg@FreeBSD.org>2014-08-19 06:50:54 +0000
commitd7cd1d425cc1ea9451fa235e3af9b6625c3e0de2 (patch)
treeb04f4bd7cd887f50e7d98af35f46b9834ff86c80 /usr.sbin/gstat
parent3c8e37b1d04827f33c0c9a7594bd1b1ef7cdb3d3 (diff)
parent4fbde208c6460d576f64d6dc3cdc6cab085a4283 (diff)
downloadFreeBSD-src-d7cd1d425cc1ea9451fa235e3af9b6625c3e0de2.zip
FreeBSD-src-d7cd1d425cc1ea9451fa235e3af9b6625c3e0de2.tar.gz
Merge head from 7/28
Diffstat (limited to 'usr.sbin/gstat')
-rw-r--r--usr.sbin/gstat/gstat.89
-rw-r--r--usr.sbin/gstat/gstat.c32
2 files changed, 35 insertions, 6 deletions
diff --git a/usr.sbin/gstat/gstat.8 b/usr.sbin/gstat/gstat.8
index 9ac6789..6c0430e 100644
--- a/usr.sbin/gstat/gstat.8
+++ b/usr.sbin/gstat/gstat.8
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd March 12, 2009
+.Dd July 3, 2014
.Dt GSTAT 8
.Os
.Sh NAME
@@ -32,7 +32,7 @@
.Nd print statistics about GEOM disks
.Sh SYNOPSIS
.Nm
-.Op Fl abcd
+.Op Fl abcdop
.Op Fl f Ar filter
.Op Fl I Ar interval
.Sh DESCRIPTION
@@ -69,6 +69,9 @@ Only devices with the names matching
will be displayed.
The format of the regular expression is described in
.Xr re_format 7 .
+.It Fl o
+Enable display of statistics for other operations
+.Pq Dv BIO_FLUSH .
.It Fl I Ar interval
Refresh the
.Nm
@@ -81,6 +84,8 @@ or
.Cm us
(the default) indicates that the update interval is specified in
seconds, milliseconds, or microseconds, respectively.
+.It Fl p
+Only display physical providers (those with rank of 1).
.El
.Sh EXIT STATUS
.Ex -std
diff --git a/usr.sbin/gstat/gstat.c b/usr.sbin/gstat/gstat.c
index 39054eb..d83ef79 100644
--- a/usr.sbin/gstat/gstat.c
+++ b/usr.sbin/gstat/gstat.c
@@ -51,7 +51,7 @@
#include <sysexits.h>
#include <unistd.h>
-static int flag_a, flag_b, flag_c, flag_d;
+static int flag_a, flag_b, flag_c, flag_d, flag_o, flag_p;
static int flag_I = 1000000;
#define PRINTMSG(...) do { \
@@ -88,7 +88,7 @@ main(int argc, char **argv)
char *p;
char f_s[100], pf_s[100], tmp_f_s[100];
const char *line;
- long double ld[11];
+ long double ld[13];
uint64_t u64;
EditLine *el;
History *hist;
@@ -104,7 +104,7 @@ main(int argc, char **argv)
flag_b = 1;
f_s[0] = '\0';
- while ((i = getopt(argc, argv, "adcf:I:b")) != -1) {
+ while ((i = getopt(argc, argv, "abdcf:I:op")) != -1) {
switch (i) {
case 'a':
flag_a = 1;
@@ -126,6 +126,9 @@ main(int argc, char **argv)
"Invalid filter - see re_format(7)");
strncpy(f_s, optarg, sizeof(f_s));
break;
+ case 'o':
+ flag_o = 1;
+ break;
case 'I':
p = NULL;
i = strtoul(optarg, &p, 0);
@@ -140,6 +143,9 @@ main(int argc, char **argv)
i *= 1;
flag_I = i;
break;
+ case 'p':
+ flag_p = 1;
+ break;
case '?':
default:
usage();
@@ -229,6 +235,8 @@ main(int argc, char **argv)
PRINTMSG(" w/s kBps ms/w ");
if (flag_d)
PRINTMSG(" d/s kBps ms/d ");
+ if (flag_o)
+ PRINTMSG(" o/s ms/o ");
PRINTMSG("%%busy Name\n");
for (;;) {
gsp = geom_stats_snapshot_next(sp);
@@ -249,6 +257,9 @@ main(int argc, char **argv)
continue;
if (gid->lg_what == ISCONSUMER && !flag_c)
continue;
+ if (flag_p && gid->lg_what == ISPROVIDER &&
+ ((struct gprovider *)(gid->lg_ptr))->lg_geom->lg_rank != 1)
+ continue;
/* Do not print past end of window */
if (!flag_b) {
getyx(stdscr, cury, curx);
@@ -279,9 +290,14 @@ main(int argc, char **argv)
DSM_MS_PER_TRANSACTION_WRITE, &ld[6],
DSM_BUSY_PCT, &ld[7],
+
DSM_TRANSFERS_PER_SECOND_FREE, &ld[8],
DSM_MB_PER_SECOND_FREE, &ld[9],
DSM_MS_PER_TRANSACTION_FREE, &ld[10],
+
+ DSM_TRANSFERS_PER_SECOND_OTHER, &ld[11],
+ DSM_MS_PER_TRANSACTION_OTHER, &ld[12],
+
DSM_NONE);
if (flag_a && ld[7] < 0.1) {
@@ -313,6 +329,14 @@ main(int argc, char **argv)
PRINTMSG(" %6.1f", (double)ld[10]);
}
+ if (flag_o) {
+ PRINTMSG(" %6.0f", (double)ld[11]);
+ if (ld[12] > 1e3)
+ PRINTMSG(" %6.0f", (double)ld[12]);
+ else
+ PRINTMSG(" %6.1f", (double)ld[12]);
+ }
+
if (ld[7] > 80)
i = 3;
else if (ld[7] > 50)
@@ -425,7 +449,7 @@ main(int argc, char **argv)
static void
usage(void)
{
- fprintf(stderr, "usage: gstat [-abcd] [-f filter] [-I interval]\n");
+ fprintf(stderr, "usage: gstat [-abcdp] [-f filter] [-I interval]\n");
exit(EX_USAGE);
/* NOTREACHED */
}
OpenPOWER on IntegriCloud