NetBSD/usr.sbin/iostat/iostat.8

366 lines
8.9 KiB
Groff

.\" $NetBSD: iostat.8,v 1.30 2023/07/28 12:03:33 wiz Exp $
.\"
.\" Copyright (c) 1985, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" from: @(#)iostat.8 8.1 (Berkeley) 6/6/93
.\"
.Dd July 28, 2023
.Dt IOSTAT 8
.Os
.Sh NAME
.Nm iostat
.Nd report I/O statistics
.Sh SYNOPSIS
.Nm
.Op Fl CDdITXxyz
.Op Fl c Ar count
.Op Fl H Ar height
.Op Fl W Ar width
.Op Fl w Ar wait
.Op Ar drives
.Sh DESCRIPTION
.Nm
displays kernel I/O statistics on terminal, disk and CPU operations.
By default,
.Nm
displays one line of statistics averaged over the machine's run time.
The use of
.Fl c
or
.Fl w
presents successive lines averaged over the
.Ar wait
period.
The
.Fl I
option causes
.Nm
to print raw, unaveraged values (totals).
.Pp
Only the last disk option specified
.Fl ( d ,
.Fl D ,
.Fl X ,
.Fl x ,
or
.Fl y )
is used.
.Pp
The options are as follows:
.Bl -tag -width XNXsystemX
.It Fl C
Show CPU statistics.
This is enabled by default unless any of the
.Fl D ,
.Fl d ,
.Fl T ,
.Fl X ,
.Fl x ,
or
.Fl y
flags are used.
.It Fl c Ar count
Repeat the display
.Ar count
times.
Unless the
.Fl I
flag is in effect, the first display is for the time since a reboot and
each subsequent report is for the time period since the last display.
If no
.Ar wait
interval is specified, the default is 1 second.
.It Fl D
Show alternative disk statistics.
Displays
number of transfers,
kilobytes transferred,
and
time spent in transfers,
during the
.Ar wait
period (or since boot with
.Fl I ) .
Use of this flag disables the default display.
.It Fl d
Show disk statistics.
This is the default.
Displays
number of transfers per second,
kilobytes per transfer,
and
megabytes transferred per second.
Use of this flag disables the default display of CPU and tty statistics.
.It Fl H Ar height
Set the page size (length, or height) explicitly, as the number of lines,
.Ar height .
If not set, the page length is taken from the environment variable
.Ev LINES
if set, or from the terminal (window) size, if output is to a terminal
and its size is set,
and otherwise defaults to 20.
If explicitly set to zero, pages are considered to be infinitely long.
This parameter determines the frequency at which repeated headers are output.
If the value is greater than zero, but too small for the header, along with
one output set, then a new header will be produced for each set of output.
.It Fl I
Show the running total values, rather than an average.
.ig ii
.It Fl i
Like
.Fl I
except the totals shown are those since
.Nm
started running, rather than since the system booted.
In this case the first output would necessarily be zero,
so is suppressed.
Consequently this option produces no output if neither
.Fl c
nor
.Fl w
is given.
.ii
.It Fl T
Show tty statistics.
This is enabled by default unless one, or more, of the
.Fl C ,
.Fl D ,
.Fl d ,
.Fl X ,
.Fl x ,
or
.Fl y
flags are used.
.ig uu
.It Fl u
When totals are being shown
.Pq Fl I
.ig ii
.Po or
.Fl i Pc
.ii
include a column after each relevant output column
showing the difference between this output and the previous.
These added columns will be blank in the first displayed output.
.uu
.It Fl W Ar width
Set the page width explicitly, as the number of columns of characters,
.Ar width .
If not set, the page width is taken from the environment variable
.Ev COLUMNS
if set, or from the terminal (window) size, if output is to a terminal
and its size is set,
and otherwise defaults to 80.
If explicitly set to 0, lines are considered infinitely long.
This width is used only to determine the number of drives to display
by default when no drive list is given.
In other cases output will be as wide as needed to display the
data requested.
.It Fl w Ar wait
Pause
.Ar wait
seconds between each display.
If no repeat
.Ar count
is specified, the default is infinity.
.It Fl X
Show limited alternative disk statistics.
Displays megabytes transferred, and time spent in transfers, during the
.Ar wait
period (or since boot with
.Fl I ) .
Use of this flag disables the default display.
.It Fl x
Show extended disk statistics.
Each disk is displayed on a line of its own with all available
statistics.
This option overrides all other display options, and all
disks are displayed unless specific disk names
are provided as arguments.
Additionally, separate read and write statistics are displayed.
The
.Fl C
and
.Fl T
options are ignored with this output format.
.It Fl y
Shows the extended statistics (as with
.Fl x )
and additional queuing statistics.
Output does not fit in an 80 column window.
The
.Fl C
and
.Fl T
options are ignored with this output format.
.It Fl z
Replaces drive and CPU statistic outputs that are exactly zero with spaces.
Note that zero values can still appear \(en this indicates a
value that was not zero, but was rounded down so appears as zero.
Drive output is replaced by spaces only when the drive did no
input or output at all in the interval,
or with
.Fl I ,
has never done any I/O.
.El
.Pp
.Nm
displays its information in the following format:
.Bl -tag -width flag
.It tty
.Bl -tag -width indent -compact
.It tin
characters read from terminals
.It tout
characters written to terminals
.El
.It disks
Disk operations.
The header of the field is the disk name and unit number.
If more drives are configured in the system that fit across the
current display,
.Nm
displays only those drives that fit on the display.
To force
.Nm
to display specific drives, they may be supplied on the command
line, either as names or
.Fn fnmatch
patterns.
.Pp
.Bl -tag -width indent -compact
.It t/s
transfers per second
.It KB/t
Kilobytes transferred per disk transfer
.It MB/s
Megabytes transferred per second
.El
.Pp
The alternative display format, (selected with
.Fl D ) ,
presents the following values:
.Pp
.Bl -tag -width indent -compact
.It xfr
Disk transfers
.It KB
Kilobytes transferred
.It time
Seconds spent in disk activity
.El
.Pp
With the
.Fl y
flag, the following queuing measurements are added:
.Pp
.Bl -tag -width indent -compact
.It wait
Number of I/O requests queued up
.It actv
Number of currently active I/O requests
.It wsvc_t
Average waiting time of an I/O request in milliseconds
.It asvc_t
Average duration of an I/O request in milliseconds
.It wtime
Seconds spent in the waiting queue.
Queuing data might not be available from all drivers
and is then shown as zeros.
.El
.Pp
With the
.Fl X
flag, the following queuing measurements are added:
.Pp
.Bl -tag -width indent -compact
.It MB/s
Megabytes transferred per second
.It time
Seconds spent in disk activity
.El
.It cpu
.Bl -tag -width indent -compact
.It \&us
% of CPU time in user mode
.It \&ni
% of CPU time in user mode running niced processes
.It \&sy
% of CPU time in system mode
.It \&in
% of CPU time in interrupt mode
.It \&id
% of CPU time in idle mode
.El
.Pp
Note that because of rounding, these percentages may
appear to total more or less than 100.
.El
.Sh SEE ALSO
.Xr fstat 1 ,
.Xr netstat 1 ,
.Xr nfsstat 1 ,
.Xr ps 1 ,
.Xr systat 1 ,
.Xr vmstat 1 ,
.Xr fnmatch 3 ,
.Xr pstat 8
.Pp
The sections starting with ``Interpreting system activity'' in
.%T "Installing and Operating 4.3BSD" .
.Sh HISTORY
.Nm
appeared in
.At v6 .
The
.Fl x
option was added in
.Nx 1.4 .
Collection of queuing values and the
.Fl y
option were added in
.Nx 8.0 .
The
.Fl X
option was added in
.Nx 11.0 .
The archaic option format:
.br
.ti +3n
.Nm
.Op Ar drives ...
.Oo Ar wait Oo Ar count Oc Oc
.br
remains supported (the first
.Ar drive
whose name starts with a digit is taken to be the
.Ar wait
period) but is deprecated,
and may be removed in a future version,
so should not be used.