zpool iostat should print headers when terminal fills

When `zpool iostat` fills the terminal the headers should be
printed again.  `zpool iostat -n` can be used to suppress this.

If the command is not attached to a tty, headers will not be
printed so as to not break existing scripts.

Reviewed-by: Joshua M. Clulow <josh@sysmgr.org>
Reviewed-by: Giuseppe Di Natale <guss80@gmail.com>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Damian Wojsław <damian@wojslaw.pl>
Closes #8235
Closes #8262
This commit is contained in:
Damian Wojsław
2019-01-23 22:29:49 +01:00
committed by Brian Behlendorf
parent b5d693581d
commit 8fccfa8e17
2 changed files with 41 additions and 7 deletions
+9 -3
View File
@@ -123,7 +123,7 @@
.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
@@ -1631,7 +1631,7 @@ with no flags on the relevant target devices.
.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
@@ -1643,7 +1643,10 @@ When given an
.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
@@ -1735,6 +1738,8 @@ Display real paths for vdevs resolving all symbolic links. This can
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.
@@ -1760,6 +1765,7 @@ pool, in addition to the pool-wide statistics.
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