return (gettext("\tiostat [[[-c [script1,script2,...]"
"[-lq]]|[-rw]] [-T d | u] [-ghHLpPvy]\n"
"\t [[pool ...]|[pool vdev ...]|[vdev ...]]"
- " [interval [count]]\n"));
+ " [[-n] interval [count]]\n"));
case HELP_LABELCLEAR:
return (gettext("\tlabelclear [-f] <vdev>\n"));
case HELP_LIST:
* -w Display latency histograms
* -r Display request size histogram
* -T Display a timestamp in date(1) or Unix format
+ * -n Only print headers once
*
* This command can be tricky because we want to be able to deal with pool
* creation/destruction as well as vdev configuration changes. The bulk of this
int npools;
float interval = 0;
unsigned long count = 0;
+ struct winsize win;
+ int winheight = 24;
zpool_list_t *list;
boolean_t verbose = B_FALSE;
boolean_t latency = B_FALSE, l_histo = B_FALSE, rq_histo = B_FALSE;
boolean_t guid = B_FALSE;
boolean_t follow_links = B_FALSE;
boolean_t full_name = B_FALSE;
+ boolean_t headers_once = B_FALSE;
iostat_cbdata_t cb = { 0 };
char *cmd = NULL;
uint64_t unsupported_flags;
/* check options */
- while ((c = getopt(argc, argv, "c:gLPT:vyhplqrwH")) != -1) {
+ while ((c = getopt(argc, argv, "c:gLPT:vyhplqrwnH")) != -1) {
switch (c) {
case 'c':
if (cmd != NULL) {
case 'y':
omit_since_boot = B_TRUE;
break;
+ case 'n':
+ headers_once = B_TRUE;
+ break;
case 'h':
usage(B_FALSE);
break;
cb.vcdl = NULL;
}
+ /*
+ * Are we connected to TTY? If not, headers_once
+ * should be true, to avoid breaking scripts.
+ */
+ if (isatty(fileno(stdout)) == 0)
+ headers_once = B_TRUE;
+
+ /*
+ * Check terminal size so we can print headers
+ * even when terminal window has its height
+ * changed.
+ */
+ if (headers_once == B_FALSE) {
+ if (ioctl(1, TIOCGWINSZ, &win) != -1 &&
+ win.ws_row > 0)
+ winheight = win.ws_row;
+ else
+ headers_once = B_TRUE;
+ }
+
/*
* If it's the first time and we're not skipping it,
* or either skip or verbose mode, print the header.
* every vdev, so skip this for histograms.
*/
if (((++cb.cb_iteration == 1 && !skip) ||
- (skip != verbose)) &&
+ (skip != verbose) ||
+ (!headers_once &&
+ (cb.cb_iteration % winheight) == 0)) &&
(!(cb.cb_flags & IOS_ANYHISTO_M)) &&
!cb.cb_scripted)
print_iostat_header(&cb);
continue;
}
-
pool_list_iter(list, B_FALSE, print_iostat, &cb);
/*
.Cm iostat
.Op Oo Oo Fl c Ar SCRIPT Oc Oo Fl lq Oc Oc Ns | Ns Fl rw
.Op Fl T Sy u Ns | Ns Sy d
-.Op Fl ghHLpPvy
+.Op Fl ghHLnpPvy
.Oo Oo Ar pool Ns ... Oc Ns | Ns Oo Ar pool vdev Ns ... Oc Ns | Ns Oo Ar vdev Ns ... Oc Oc
.Op Ar interval Op Ar count
.Nm
.Cm iostat
.Op Oo Oo Fl c Ar SCRIPT Oc Oo Fl lq Oc Oc Ns | Ns Fl rw
.Op Fl T Sy u Ns | Ns Sy d
-.Op Fl ghHLpPvy
+.Op Fl ghHLnpPvy
.Oo Oo Ar pool Ns ... Oc Ns | Ns Oo Ar pool vdev Ns ... Oc Ns | Ns Oo Ar vdev Ns ... Oc Oc
.Op Ar interval Op Ar count
.Xc
.Ar interval ,
the statistics are printed every
.Ar interval
-seconds until ^C is pressed. If count is specified, the command exits
+seconds until ^C is pressed. If
+.Fl n
+flag is specified the headers are displayed only once, otherwise they are
+displayed periodically. If count is specified, the command exits
after count reports are printed. The first report printed is always
the statistics since boot regardless of whether
.Ar interval
be used to look up the current block device name regardless of the
.Pa /dev/disk/
path used to open it.
+.It Fl n
+Print headers only once when passed
.It Fl p
Display numbers in parsable (exact) values. Time values are in
nanoseconds.
Omit statistics since boot.
Normally the first line of output reports the statistics since boot.
This option suppresses that first line of output.
+.Ar interval
.It Fl w
Display latency histograms:
.Pp