Add -o option to gstat to display "other" operatins (e.g. BIO_FLUSH).

MFC after:	1 week
This commit is contained in:
Alexander Motin 2014-05-17 15:26:08 +00:00
parent 413037c8e7
commit 16f6e71505
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=266320
2 changed files with 26 additions and 5 deletions

View File

@ -24,7 +24,7 @@
.\" .\"
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd March 12, 2009 .Dd May 17, 2014
.Dt GSTAT 8 .Dt GSTAT 8
.Os .Os
.Sh NAME .Sh NAME
@ -32,7 +32,7 @@
.Nd print statistics about GEOM disks .Nd print statistics about GEOM disks
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Op Fl abcd .Op Fl abcdo
.Op Fl f Ar filter .Op Fl f Ar filter
.Op Fl I Ar interval .Op Fl I Ar interval
.Sh DESCRIPTION .Sh DESCRIPTION
@ -69,6 +69,9 @@ Only devices with the names matching
will be displayed. will be displayed.
The format of the regular expression is described in The format of the regular expression is described in
.Xr re_format 7 . .Xr re_format 7 .
.It Fl o
Enable display of statistics for other operations
.Pq Dv BIO_FLUSH .
.It Fl I Ar interval .It Fl I Ar interval
Refresh the Refresh the
.Nm .Nm

View File

@ -51,7 +51,7 @@
#include <sysexits.h> #include <sysexits.h>
#include <unistd.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;
static int flag_I = 1000000; static int flag_I = 1000000;
#define PRINTMSG(...) do { \ #define PRINTMSG(...) do { \
@ -88,7 +88,7 @@ main(int argc, char **argv)
char *p; char *p;
char f_s[100], pf_s[100], tmp_f_s[100]; char f_s[100], pf_s[100], tmp_f_s[100];
const char *line; const char *line;
long double ld[11]; long double ld[13];
uint64_t u64; uint64_t u64;
EditLine *el; EditLine *el;
History *hist; History *hist;
@ -104,7 +104,7 @@ main(int argc, char **argv)
flag_b = 1; flag_b = 1;
f_s[0] = '\0'; f_s[0] = '\0';
while ((i = getopt(argc, argv, "adcf:I:b")) != -1) { while ((i = getopt(argc, argv, "abdcf:oI:")) != -1) {
switch (i) { switch (i) {
case 'a': case 'a':
flag_a = 1; flag_a = 1;
@ -126,6 +126,9 @@ main(int argc, char **argv)
"Invalid filter - see re_format(7)"); "Invalid filter - see re_format(7)");
strncpy(f_s, optarg, sizeof(f_s)); strncpy(f_s, optarg, sizeof(f_s));
break; break;
case 'o':
flag_o = 1;
break;
case 'I': case 'I':
p = NULL; p = NULL;
i = strtoul(optarg, &p, 0); i = strtoul(optarg, &p, 0);
@ -229,6 +232,8 @@ main(int argc, char **argv)
PRINTMSG(" w/s kBps ms/w "); PRINTMSG(" w/s kBps ms/w ");
if (flag_d) if (flag_d)
PRINTMSG(" d/s kBps ms/d "); PRINTMSG(" d/s kBps ms/d ");
if (flag_o)
PRINTMSG(" o/s ms/o ");
PRINTMSG("%%busy Name\n"); PRINTMSG("%%busy Name\n");
for (;;) { for (;;) {
gsp = geom_stats_snapshot_next(sp); gsp = geom_stats_snapshot_next(sp);
@ -279,9 +284,14 @@ main(int argc, char **argv)
DSM_MS_PER_TRANSACTION_WRITE, &ld[6], DSM_MS_PER_TRANSACTION_WRITE, &ld[6],
DSM_BUSY_PCT, &ld[7], DSM_BUSY_PCT, &ld[7],
DSM_TRANSFERS_PER_SECOND_FREE, &ld[8], DSM_TRANSFERS_PER_SECOND_FREE, &ld[8],
DSM_MB_PER_SECOND_FREE, &ld[9], DSM_MB_PER_SECOND_FREE, &ld[9],
DSM_MS_PER_TRANSACTION_FREE, &ld[10], DSM_MS_PER_TRANSACTION_FREE, &ld[10],
DSM_TRANSFERS_PER_SECOND_OTHER, &ld[11],
DSM_MS_PER_TRANSACTION_OTHER, &ld[12],
DSM_NONE); DSM_NONE);
if (flag_a && ld[7] < 0.1) { if (flag_a && ld[7] < 0.1) {
@ -313,6 +323,14 @@ main(int argc, char **argv)
PRINTMSG(" %6.1f", (double)ld[10]); 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) if (ld[7] > 80)
i = 3; i = 3;
else if (ld[7] > 50) else if (ld[7] > 50)