1998-09-15 06:49:18 +00:00
|
|
|
.\"
|
Add a prioritization field to the devstat_add_entry() call so that
peripheral drivers can determine where in the devstat(9) list they are
inserted.
This requires recompilation of libdevstat, systat, vmstat, rpc.rstatd, and
any ports that depend on the devstat code, since the size of the devstat
structure has changed. The devstat version number has been incremented as
well to reflect the change.
This sorts devices in the devstat list in "more interesting" to "less
interesting" order. So, for instance, da devices are now more important
than floppy drives, and so will appear before floppy drives in the default
output from systat, iostat, vmstat, etc.
The order of devices is, for now, kept in a central table in devicestat.h.
If individual drivers were able to make a meaningful decision on what
priority they should be at attach time, we could consider splitting the
priority information out into the various drivers. For now, though, they
have no way of knowing that, so it's easier to put them in an easy to find
table.
Also, move the checkversion() call in vmstat(8) to a more logical place.
Thanks to Bruce and David O'Brien for suggestions, for reviewing this, and
for putting up with the long time it has taken me to commit it. Bruce did
object somewhat to the central priority table (he would rather the
priorities be distributed in each driver), so his objection is duly noted
here.
Reviewed by: bde, obrien
1999-02-10 00:04:13 +00:00
|
|
|
.\" Copyright (c) 1998, 1999 Kenneth D. Merry.
|
1998-09-15 06:49:18 +00:00
|
|
|
.\" 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. The name of the author may not be used to endorse or promote products
|
|
|
|
.\" derived from this software without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
|
|
|
|
.\"
|
1999-08-28 00:22:10 +00:00
|
|
|
.\" $FreeBSD$
|
1998-09-15 06:49:18 +00:00
|
|
|
.\"
|
2018-08-23 01:42:45 +00:00
|
|
|
.Dd August 22, 2018
|
1998-09-15 06:49:18 +00:00
|
|
|
.Dt DEVSTAT 9
|
2001-07-10 15:31:11 +00:00
|
|
|
.Os
|
1998-09-15 06:49:18 +00:00
|
|
|
.Sh NAME
|
1999-09-21 19:18:09 +00:00
|
|
|
.Nm devstat ,
|
|
|
|
.Nm devstat_add_entry ,
|
1999-09-23 13:31:15 +00:00
|
|
|
.Nm devstat_end_transaction ,
|
2000-05-11 16:25:03 +00:00
|
|
|
.Nm devstat_end_transaction_bio ,
|
2018-08-23 01:42:45 +00:00
|
|
|
.Nm devstat_end_transaction_bio_bt ,
|
1999-09-21 19:18:09 +00:00
|
|
|
.Nm devstat_remove_entry ,
|
2018-08-23 01:42:45 +00:00
|
|
|
.Nm devstat_start_transaction ,
|
|
|
|
.Nm devstat_start_transaction_bio
|
1998-09-15 06:49:18 +00:00
|
|
|
.Nd kernel interface for keeping device statistics
|
|
|
|
.Sh SYNOPSIS
|
2001-10-01 16:09:29 +00:00
|
|
|
.In sys/devicestat.h
|
1998-09-15 06:49:18 +00:00
|
|
|
.Ft void
|
|
|
|
.Fo devstat_add_entry
|
|
|
|
.Fa "struct devstat *ds"
|
1999-03-06 17:10:15 +00:00
|
|
|
.Fa "const char *dev_name"
|
1998-09-15 06:49:18 +00:00
|
|
|
.Fa "int unit_number"
|
2012-02-12 18:29:56 +00:00
|
|
|
.Fa "uint32_t block_size"
|
1998-09-15 06:49:18 +00:00
|
|
|
.Fa "devstat_support_flags flags"
|
|
|
|
.Fa "devstat_type_flags device_type"
|
Add a prioritization field to the devstat_add_entry() call so that
peripheral drivers can determine where in the devstat(9) list they are
inserted.
This requires recompilation of libdevstat, systat, vmstat, rpc.rstatd, and
any ports that depend on the devstat code, since the size of the devstat
structure has changed. The devstat version number has been incremented as
well to reflect the change.
This sorts devices in the devstat list in "more interesting" to "less
interesting" order. So, for instance, da devices are now more important
than floppy drives, and so will appear before floppy drives in the default
output from systat, iostat, vmstat, etc.
The order of devices is, for now, kept in a central table in devicestat.h.
If individual drivers were able to make a meaningful decision on what
priority they should be at attach time, we could consider splitting the
priority information out into the various drivers. For now, though, they
have no way of knowing that, so it's easier to put them in an easy to find
table.
Also, move the checkversion() call in vmstat(8) to a more logical place.
Thanks to Bruce and David O'Brien for suggestions, for reviewing this, and
for putting up with the long time it has taken me to commit it. Bruce did
object somewhat to the central priority table (he would rather the
priorities be distributed in each driver), so his objection is duly noted
here.
Reviewed by: bde, obrien
1999-02-10 00:04:13 +00:00
|
|
|
.Fa "devstat_priority priority"
|
1998-09-15 06:49:18 +00:00
|
|
|
.Fc
|
|
|
|
.Ft void
|
|
|
|
.Fn devstat_remove_entry "struct devstat *ds"
|
|
|
|
.Ft void
|
2018-08-23 01:42:45 +00:00
|
|
|
.Fo devstat_start_transaction
|
|
|
|
.Fa "struct devstat *ds"
|
|
|
|
.Fa "const struct bintime *now"
|
|
|
|
.Fc
|
|
|
|
.Ft void
|
|
|
|
.Fo devstat_start_transaction_bio
|
|
|
|
.Fa "struct devstat *ds"
|
|
|
|
.Fa "struct bio *bp"
|
|
|
|
.Fc
|
1998-09-15 06:49:18 +00:00
|
|
|
.Ft void
|
|
|
|
.Fo devstat_end_transaction
|
|
|
|
.Fa "struct devstat *ds"
|
2012-02-12 18:29:56 +00:00
|
|
|
.Fa "uint32_t bytes"
|
1998-09-15 06:49:18 +00:00
|
|
|
.Fa "devstat_tag_type tag_type"
|
|
|
|
.Fa "devstat_trans_flags flags"
|
2018-08-23 01:42:45 +00:00
|
|
|
.Fa "const struct bintime *now"
|
|
|
|
.Fa "const struct bintime *then"
|
1998-09-15 06:49:18 +00:00
|
|
|
.Fc
|
1999-09-18 21:31:19 +00:00
|
|
|
.Ft void
|
2000-05-11 16:25:03 +00:00
|
|
|
.Fo devstat_end_transaction_bio
|
1999-09-18 21:31:19 +00:00
|
|
|
.Fa "struct devstat *ds"
|
2018-08-23 01:42:45 +00:00
|
|
|
.Fa "const struct bio *bp"
|
|
|
|
.Fc
|
|
|
|
.Fc
|
|
|
|
.Ft void
|
|
|
|
.Fo devstat_end_transaction_bio_bt
|
|
|
|
.Fa "struct devstat *ds"
|
|
|
|
.Fa "const struct bio *bp"
|
|
|
|
.Fa "const struct bintime *now"
|
1999-09-18 21:31:19 +00:00
|
|
|
.Fc
|
1998-09-15 06:49:18 +00:00
|
|
|
.Sh DESCRIPTION
|
Add a prioritization field to the devstat_add_entry() call so that
peripheral drivers can determine where in the devstat(9) list they are
inserted.
This requires recompilation of libdevstat, systat, vmstat, rpc.rstatd, and
any ports that depend on the devstat code, since the size of the devstat
structure has changed. The devstat version number has been incremented as
well to reflect the change.
This sorts devices in the devstat list in "more interesting" to "less
interesting" order. So, for instance, da devices are now more important
than floppy drives, and so will appear before floppy drives in the default
output from systat, iostat, vmstat, etc.
The order of devices is, for now, kept in a central table in devicestat.h.
If individual drivers were able to make a meaningful decision on what
priority they should be at attach time, we could consider splitting the
priority information out into the various drivers. For now, though, they
have no way of knowing that, so it's easier to put them in an easy to find
table.
Also, move the checkversion() call in vmstat(8) to a more logical place.
Thanks to Bruce and David O'Brien for suggestions, for reviewing this, and
for putting up with the long time it has taken me to commit it. Bruce did
object somewhat to the central priority table (he would rather the
priorities be distributed in each driver), so his objection is duly noted
here.
Reviewed by: bde, obrien
1999-02-10 00:04:13 +00:00
|
|
|
The devstat subsystem is an interface for recording device
|
2003-10-23 01:54:06 +00:00
|
|
|
statistics, as its name implies.
|
|
|
|
The idea is to keep reasonably detailed
|
1998-09-15 06:49:18 +00:00
|
|
|
statistics while utilizing a minimum amount of CPU time to record them.
|
|
|
|
Thus, no statistical calculations are actually performed in the kernel
|
|
|
|
portion of the
|
2000-11-20 18:41:33 +00:00
|
|
|
.Nm
|
2004-07-03 18:29:24 +00:00
|
|
|
code.
|
|
|
|
Instead, that is left for user programs to handle.
|
1998-09-15 06:49:18 +00:00
|
|
|
.Pp
|
2018-08-23 01:42:45 +00:00
|
|
|
The historical and antiquated
|
|
|
|
.Nm
|
|
|
|
model assumed a single active IO operation per device, which is not accurate
|
|
|
|
for most disk-like drivers in the 2000s and beyond.
|
|
|
|
New consumers of the interface should almost certainly use only the "bio"
|
|
|
|
variants of the start and end transacation routines.
|
|
|
|
.Pp
|
1998-09-15 06:49:18 +00:00
|
|
|
.Fn devstat_add_entry
|
|
|
|
registers a device with the
|
|
|
|
.Nm
|
2003-10-23 01:54:06 +00:00
|
|
|
subsystem.
|
|
|
|
The caller is expected to have already allocated \fBand zeroed\fR
|
1998-09-15 06:49:18 +00:00
|
|
|
the devstat structure before calling this function.
|
|
|
|
.Fn devstat_add_entry
|
|
|
|
takes several arguments:
|
|
|
|
.Bl -tag -width device_type
|
|
|
|
.It ds
|
|
|
|
The
|
|
|
|
.Va devstat
|
|
|
|
structure, allocated and zeroed by the client.
|
|
|
|
.It dev_name
|
2018-08-23 01:42:45 +00:00
|
|
|
The device name, e.g., da, cd, sa.
|
1998-09-15 06:49:18 +00:00
|
|
|
.It unit_number
|
|
|
|
Device unit number.
|
|
|
|
.It block_size
|
2003-10-23 01:54:06 +00:00
|
|
|
Block size of the device, if supported.
|
|
|
|
If the device does not support a
|
1998-09-15 06:49:18 +00:00
|
|
|
block size, or if the blocksize is unknown at the time the device is added
|
|
|
|
to the
|
|
|
|
.Nm
|
|
|
|
list, it should be set to 0.
|
|
|
|
.It flags
|
2003-10-23 01:54:06 +00:00
|
|
|
Flags indicating operations supported or not supported by the device.
|
|
|
|
See below for details.
|
1998-09-15 06:49:18 +00:00
|
|
|
.It device_type
|
2003-10-23 01:54:06 +00:00
|
|
|
The device type.
|
2004-07-03 18:29:24 +00:00
|
|
|
This is broken into three sections: base device type
|
2018-08-23 01:42:45 +00:00
|
|
|
(e.g., direct access, CDROM, sequential access), interface type (IDE, SCSI
|
2003-10-23 01:54:06 +00:00
|
|
|
or other) and a pass-through flag to indicate pas-through devices.
|
|
|
|
See below for a complete list of types.
|
Add a prioritization field to the devstat_add_entry() call so that
peripheral drivers can determine where in the devstat(9) list they are
inserted.
This requires recompilation of libdevstat, systat, vmstat, rpc.rstatd, and
any ports that depend on the devstat code, since the size of the devstat
structure has changed. The devstat version number has been incremented as
well to reflect the change.
This sorts devices in the devstat list in "more interesting" to "less
interesting" order. So, for instance, da devices are now more important
than floppy drives, and so will appear before floppy drives in the default
output from systat, iostat, vmstat, etc.
The order of devices is, for now, kept in a central table in devicestat.h.
If individual drivers were able to make a meaningful decision on what
priority they should be at attach time, we could consider splitting the
priority information out into the various drivers. For now, though, they
have no way of knowing that, so it's easier to put them in an easy to find
table.
Also, move the checkversion() call in vmstat(8) to a more logical place.
Thanks to Bruce and David O'Brien for suggestions, for reviewing this, and
for putting up with the long time it has taken me to commit it. Bruce did
object somewhat to the central priority table (he would rather the
priorities be distributed in each driver), so his objection is duly noted
here.
Reviewed by: bde, obrien
1999-02-10 00:04:13 +00:00
|
|
|
.It priority
|
2003-10-23 01:54:06 +00:00
|
|
|
The device priority.
|
|
|
|
The priority is used to determine how devices are
|
2001-07-14 19:41:16 +00:00
|
|
|
sorted within
|
2000-11-20 18:41:33 +00:00
|
|
|
.Nm devstat Ns 's
|
2003-10-23 01:54:06 +00:00
|
|
|
list of devices.
|
|
|
|
Devices are sorted first by priority (highest to lowest),
|
|
|
|
and then by attach order.
|
|
|
|
See below for a complete list of available
|
Add a prioritization field to the devstat_add_entry() call so that
peripheral drivers can determine where in the devstat(9) list they are
inserted.
This requires recompilation of libdevstat, systat, vmstat, rpc.rstatd, and
any ports that depend on the devstat code, since the size of the devstat
structure has changed. The devstat version number has been incremented as
well to reflect the change.
This sorts devices in the devstat list in "more interesting" to "less
interesting" order. So, for instance, da devices are now more important
than floppy drives, and so will appear before floppy drives in the default
output from systat, iostat, vmstat, etc.
The order of devices is, for now, kept in a central table in devicestat.h.
If individual drivers were able to make a meaningful decision on what
priority they should be at attach time, we could consider splitting the
priority information out into the various drivers. For now, though, they
have no way of knowing that, so it's easier to put them in an easy to find
table.
Also, move the checkversion() call in vmstat(8) to a more logical place.
Thanks to Bruce and David O'Brien for suggestions, for reviewing this, and
for putting up with the long time it has taken me to commit it. Bruce did
object somewhat to the central priority table (he would rather the
priorities be distributed in each driver), so his objection is duly noted
here.
Reviewed by: bde, obrien
1999-02-10 00:04:13 +00:00
|
|
|
priorities.
|
1998-09-15 06:49:18 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
.Fn devstat_remove_entry
|
|
|
|
removes a device from the
|
|
|
|
.Nm
|
2003-10-23 01:54:06 +00:00
|
|
|
subsystem.
|
|
|
|
It takes the devstat structure for the device in question as
|
|
|
|
an argument.
|
|
|
|
The
|
1998-09-15 06:49:18 +00:00
|
|
|
.Nm
|
|
|
|
generation number is incremented and the number of devices is decremented.
|
|
|
|
.Pp
|
|
|
|
.Fn devstat_start_transaction
|
|
|
|
registers the start of a transaction with the
|
|
|
|
.Nm
|
2003-10-23 01:54:06 +00:00
|
|
|
subsystem.
|
2018-08-23 01:42:45 +00:00
|
|
|
Optionally, if the caller already has a
|
|
|
|
.Fn binuptime
|
|
|
|
value available, it may be passed in
|
|
|
|
.Fa *now .
|
|
|
|
Usually the caller can just pass
|
|
|
|
.Dv NULL
|
|
|
|
for
|
|
|
|
.Fa now ,
|
|
|
|
and the routine will gather the current
|
|
|
|
.Fn binuptime
|
|
|
|
itself.
|
2003-10-23 01:54:06 +00:00
|
|
|
The busy count is incremented with each transaction start.
|
1998-09-15 06:49:18 +00:00
|
|
|
When a device goes from idle to busy, the system uptime is recorded in the
|
2018-08-23 01:42:45 +00:00
|
|
|
.Va busy_from
|
1998-09-15 06:49:18 +00:00
|
|
|
field of the
|
|
|
|
.Va devstat
|
|
|
|
structure.
|
|
|
|
.Pp
|
2018-08-23 01:42:45 +00:00
|
|
|
.Fn devstat_start_transaction_bio
|
|
|
|
records the
|
|
|
|
.Fn binuptime
|
|
|
|
in the provided bio's
|
|
|
|
.Fa bio_t0
|
|
|
|
and then invokes
|
|
|
|
.Fn devstat_start_transaction .
|
|
|
|
.Pp
|
1998-09-15 06:49:18 +00:00
|
|
|
.Fn devstat_end_transaction
|
|
|
|
registers the end of a transaction with the
|
|
|
|
.Nm
|
2003-10-23 01:54:06 +00:00
|
|
|
subsystem.
|
2018-08-23 01:42:45 +00:00
|
|
|
It takes six arguments:
|
1998-09-15 06:49:18 +00:00
|
|
|
.Bl -tag -width tag_type
|
|
|
|
.It ds
|
|
|
|
The
|
|
|
|
.Va devstat
|
|
|
|
structure for the device in question.
|
|
|
|
.It bytes
|
|
|
|
The number of bytes transferred in this transaction.
|
|
|
|
.It tag_type
|
2003-10-23 01:54:06 +00:00
|
|
|
Transaction tag type.
|
|
|
|
See below for tag types.
|
1998-09-15 06:49:18 +00:00
|
|
|
.It flags
|
|
|
|
Transaction flags indicating whether the transaction was a read, write, or
|
|
|
|
whether no data was transferred.
|
2018-08-23 01:42:45 +00:00
|
|
|
.It now
|
|
|
|
The
|
|
|
|
.Fn binuptime
|
|
|
|
at the end of the transaction, or
|
|
|
|
.Dv NULL .
|
|
|
|
.It then
|
|
|
|
The
|
|
|
|
.Fn binuptime
|
|
|
|
at the beginning of the transaction, or
|
|
|
|
.Dv NULL .
|
1998-09-15 06:49:18 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
2018-08-23 01:42:45 +00:00
|
|
|
If
|
|
|
|
.Fa now
|
|
|
|
is
|
|
|
|
.Dv NULL ,
|
|
|
|
it collects the current time from
|
|
|
|
.Fn binuptime .
|
|
|
|
If
|
|
|
|
.Fa then
|
|
|
|
is
|
|
|
|
.Dv NULL ,
|
|
|
|
the operation is not tracked in the
|
|
|
|
.Va devstat
|
|
|
|
.Fa duration
|
|
|
|
table.
|
|
|
|
.Pp
|
2000-05-11 16:25:03 +00:00
|
|
|
.Fn devstat_end_transaction_bio
|
2018-08-23 01:42:45 +00:00
|
|
|
is a thin wrapper for
|
|
|
|
.Fn devstat_end_transaction_bio_bt
|
|
|
|
with a
|
|
|
|
.Dv NULL
|
|
|
|
.Fa now
|
|
|
|
parameter.
|
|
|
|
.Pp
|
|
|
|
.Fn devstat_end_transaction_bio_bt
|
1999-09-18 21:31:19 +00:00
|
|
|
is a wrapper for
|
|
|
|
.Fn devstat_end_transaction
|
2018-08-23 01:42:45 +00:00
|
|
|
which pulls all needed information from a
|
2000-05-11 16:25:03 +00:00
|
|
|
.Va "struct bio"
|
2018-08-23 01:42:45 +00:00
|
|
|
prepared by
|
|
|
|
.Fn devstat_start_transaction_bio .
|
|
|
|
The bio must be ready for
|
|
|
|
.Fn biodone
|
|
|
|
(i.e.,
|
|
|
|
.Fa bio_bcount
|
|
|
|
and
|
|
|
|
.Fa bio_resid
|
|
|
|
must be correctly initialized).
|
1999-09-18 21:31:19 +00:00
|
|
|
.Pp
|
1998-09-15 06:49:18 +00:00
|
|
|
The
|
|
|
|
.Va devstat
|
|
|
|
structure is composed of the following fields:
|
|
|
|
.Bl -tag -width dev_creation_time
|
2018-08-23 01:42:45 +00:00
|
|
|
.It sequence0 ,
|
|
|
|
.It sequence1
|
|
|
|
An implementation detail used to gather consistent snapshots of device
|
|
|
|
statistics.
|
|
|
|
.It start_count
|
|
|
|
Number of operations started.
|
|
|
|
.It end_count
|
|
|
|
Number of operations completed.
|
|
|
|
The
|
|
|
|
.Dq busy_count
|
|
|
|
can be calculated by subtracting
|
|
|
|
.Fa end_count
|
|
|
|
from
|
|
|
|
.Fa start_count .
|
|
|
|
.Fa ( sequence0
|
|
|
|
and
|
|
|
|
.Fa sequence1
|
|
|
|
are used to get a consistent snapshot.)
|
|
|
|
This is the current number of outstanding transactions for the device.
|
|
|
|
This should never go below zero, and on an idle device it should be zero.
|
|
|
|
If either one of these conditions is not true, it indicates a problem.
|
|
|
|
.Pp
|
|
|
|
There should be one and only one
|
|
|
|
transaction start event and one transaction end event for each transaction.
|
1998-09-15 06:49:18 +00:00
|
|
|
.It dev_links
|
|
|
|
Each
|
|
|
|
.Va devstat
|
2003-10-23 01:54:06 +00:00
|
|
|
structure is placed in a linked list when it is registered.
|
|
|
|
The
|
1998-09-15 06:49:18 +00:00
|
|
|
.Va dev_links
|
|
|
|
field contains a pointer to the next entry in the list of
|
|
|
|
.Va devstat
|
|
|
|
structures.
|
|
|
|
.It device_number
|
2003-10-23 01:54:06 +00:00
|
|
|
The device number is a unique identifier for each device.
|
|
|
|
The device
|
|
|
|
number is incremented for each new device that is registered.
|
|
|
|
The device
|
1998-09-15 06:49:18 +00:00
|
|
|
number is currently only a 32-bit integer, but it could be enlarged if
|
|
|
|
someone has a system with more than four billion device arrival events.
|
|
|
|
.It device_name
|
|
|
|
The device name is a text string given by the registering driver to
|
2003-10-23 01:54:06 +00:00
|
|
|
identify itself.
|
2018-08-23 01:42:45 +00:00
|
|
|
(e.g.,
|
1998-09-15 06:49:18 +00:00
|
|
|
.Dq da ,
|
|
|
|
.Dq cd ,
|
|
|
|
.Dq sa ,
|
|
|
|
etc.)
|
|
|
|
.It unit_number
|
|
|
|
The unit number identifies the particular instance of the peripheral driver
|
|
|
|
in question.
|
2018-08-23 01:42:45 +00:00
|
|
|
.It bytes[4]
|
|
|
|
This array contains the number of bytes that have been read (index
|
|
|
|
.Dv DEVSTAT_READ ) ,
|
|
|
|
written (index
|
|
|
|
.Dv DEVSTAT_WRITE ) ,
|
|
|
|
freed or erased (index
|
|
|
|
.Dv DEVSTAT_FREE ) ,
|
|
|
|
or other (index
|
|
|
|
.Dv DEVSTAT_NO_DATA ) .
|
|
|
|
All values are unsigned 64-bit integers.
|
|
|
|
.It operations[4]
|
|
|
|
This array contains the number of operations of a given type that have been
|
|
|
|
performed.
|
|
|
|
The indices are identical to those for
|
|
|
|
.Fa bytes
|
|
|
|
above.
|
|
|
|
.Dv DEVSTAT_NO_DATA
|
|
|
|
or "other" represents the number of transactions to the device which are
|
|
|
|
neither reads, writes, nor frees.
|
2003-10-23 01:54:06 +00:00
|
|
|
For instance,
|
1998-09-15 06:49:18 +00:00
|
|
|
.Tn SCSI
|
|
|
|
drivers often send a test unit ready command to
|
|
|
|
.Tn SCSI
|
2003-10-23 01:54:06 +00:00
|
|
|
devices.
|
|
|
|
The test unit ready command does not read or write any data.
|
|
|
|
It merely causes the device to return its status.
|
2018-08-23 01:42:45 +00:00
|
|
|
.It duration[4]
|
|
|
|
This array contains the total bintime corresponding to completed operations of
|
|
|
|
a given type.
|
|
|
|
The indices are identical to those for
|
|
|
|
.Fa bytes
|
|
|
|
above.
|
|
|
|
(Operations that complete using the historical
|
1998-09-15 06:49:18 +00:00
|
|
|
.Fn devstat_end_transaction
|
2018-08-23 01:42:45 +00:00
|
|
|
API and do not provide a non-NULL
|
|
|
|
.Fa then
|
|
|
|
are not accounted for.)
|
|
|
|
.It busy_time
|
|
|
|
This is the amount of time that the device busy count has been greater than
|
|
|
|
zero.
|
|
|
|
This is only updated when the busy count returns to zero.
|
|
|
|
.It creation_time
|
|
|
|
This is the time, as reported by
|
|
|
|
.Fn getmicrotime
|
|
|
|
that the device was registered.
|
1998-09-15 06:49:18 +00:00
|
|
|
.It block_size
|
|
|
|
This is the block size of the device, if the device has a block size.
|
|
|
|
.It tag_types
|
|
|
|
This is an array of counters to record the number of various tag types that
|
2003-10-23 01:54:06 +00:00
|
|
|
are sent to a device.
|
|
|
|
See below for a list of tag types.
|
2018-08-23 01:42:45 +00:00
|
|
|
.It busy_from
|
|
|
|
If the device is not busy, this was the time that a transaction last completed.
|
|
|
|
If the device is busy, this the most recent of either the time that the device
|
|
|
|
became busy, or the time that the last transaction completed.
|
1998-09-15 06:49:18 +00:00
|
|
|
.It flags
|
|
|
|
These flags indicate which statistics measurements are supported by a
|
2003-10-23 01:54:06 +00:00
|
|
|
particular device.
|
|
|
|
These flags are primarily intended to serve as an aid
|
1998-09-15 06:49:18 +00:00
|
|
|
to userland programs that decipher the statistics.
|
|
|
|
.It device_type
|
2003-10-23 01:54:06 +00:00
|
|
|
This is the device type.
|
2004-07-03 18:29:24 +00:00
|
|
|
It consists of three parts: the device type
|
2018-08-23 01:42:45 +00:00
|
|
|
(e.g., direct access, CDROM, sequential access, etc.), the interface (IDE,
|
2002-01-09 11:43:48 +00:00
|
|
|
SCSI or other) and whether or not the device in question is a pass-through
|
2003-10-23 01:54:06 +00:00
|
|
|
driver.
|
|
|
|
See below for a complete list of device types.
|
Add a prioritization field to the devstat_add_entry() call so that
peripheral drivers can determine where in the devstat(9) list they are
inserted.
This requires recompilation of libdevstat, systat, vmstat, rpc.rstatd, and
any ports that depend on the devstat code, since the size of the devstat
structure has changed. The devstat version number has been incremented as
well to reflect the change.
This sorts devices in the devstat list in "more interesting" to "less
interesting" order. So, for instance, da devices are now more important
than floppy drives, and so will appear before floppy drives in the default
output from systat, iostat, vmstat, etc.
The order of devices is, for now, kept in a central table in devicestat.h.
If individual drivers were able to make a meaningful decision on what
priority they should be at attach time, we could consider splitting the
priority information out into the various drivers. For now, though, they
have no way of knowing that, so it's easier to put them in an easy to find
table.
Also, move the checkversion() call in vmstat(8) to a more logical place.
Thanks to Bruce and David O'Brien for suggestions, for reviewing this, and
for putting up with the long time it has taken me to commit it. Bruce did
object somewhat to the central priority table (he would rather the
priorities be distributed in each driver), so his objection is duly noted
here.
Reviewed by: bde, obrien
1999-02-10 00:04:13 +00:00
|
|
|
.It priority
|
2003-10-23 01:54:06 +00:00
|
|
|
This is the priority.
|
|
|
|
This is the first parameter used to determine where
|
Add a prioritization field to the devstat_add_entry() call so that
peripheral drivers can determine where in the devstat(9) list they are
inserted.
This requires recompilation of libdevstat, systat, vmstat, rpc.rstatd, and
any ports that depend on the devstat code, since the size of the devstat
structure has changed. The devstat version number has been incremented as
well to reflect the change.
This sorts devices in the devstat list in "more interesting" to "less
interesting" order. So, for instance, da devices are now more important
than floppy drives, and so will appear before floppy drives in the default
output from systat, iostat, vmstat, etc.
The order of devices is, for now, kept in a central table in devicestat.h.
If individual drivers were able to make a meaningful decision on what
priority they should be at attach time, we could consider splitting the
priority information out into the various drivers. For now, though, they
have no way of knowing that, so it's easier to put them in an easy to find
table.
Also, move the checkversion() call in vmstat(8) to a more logical place.
Thanks to Bruce and David O'Brien for suggestions, for reviewing this, and
for putting up with the long time it has taken me to commit it. Bruce did
object somewhat to the central priority table (he would rather the
priorities be distributed in each driver), so his objection is duly noted
here.
Reviewed by: bde, obrien
1999-02-10 00:04:13 +00:00
|
|
|
to insert a device in the
|
2000-11-20 18:41:33 +00:00
|
|
|
.Nm
|
2003-10-23 01:54:06 +00:00
|
|
|
list.
|
|
|
|
The second parameter is attach order.
|
2018-08-23 01:42:45 +00:00
|
|
|
See below for a list of available priorities.
|
1998-09-15 06:49:18 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
2003-10-23 01:54:06 +00:00
|
|
|
Each device is given a device type.
|
2018-08-23 01:42:45 +00:00
|
|
|
Pass-through devices have the same underlying device type and interface as the
|
|
|
|
device they provide an interface for, but they also have the pass-through flag
|
|
|
|
set.
|
|
|
|
The base device types are identical to the
|
1998-09-15 06:49:18 +00:00
|
|
|
.Tn SCSI
|
|
|
|
device type numbers, so with
|
|
|
|
.Tn SCSI
|
2018-08-23 01:42:45 +00:00
|
|
|
peripherals, the device type returned from an inquiry is usually ORed with the
|
1998-09-15 06:49:18 +00:00
|
|
|
.Tn SCSI
|
2003-10-23 01:54:06 +00:00
|
|
|
interface type and the pass-through flag if appropriate.
|
|
|
|
The device type
|
1998-09-15 06:49:18 +00:00
|
|
|
flags are as follows:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
typedef enum {
|
|
|
|
DEVSTAT_TYPE_DIRECT = 0x000,
|
|
|
|
DEVSTAT_TYPE_SEQUENTIAL = 0x001,
|
|
|
|
DEVSTAT_TYPE_PRINTER = 0x002,
|
|
|
|
DEVSTAT_TYPE_PROCESSOR = 0x003,
|
|
|
|
DEVSTAT_TYPE_WORM = 0x004,
|
|
|
|
DEVSTAT_TYPE_CDROM = 0x005,
|
|
|
|
DEVSTAT_TYPE_SCANNER = 0x006,
|
|
|
|
DEVSTAT_TYPE_OPTICAL = 0x007,
|
|
|
|
DEVSTAT_TYPE_CHANGER = 0x008,
|
|
|
|
DEVSTAT_TYPE_COMM = 0x009,
|
|
|
|
DEVSTAT_TYPE_ASC0 = 0x00a,
|
|
|
|
DEVSTAT_TYPE_ASC1 = 0x00b,
|
|
|
|
DEVSTAT_TYPE_STORARRAY = 0x00c,
|
|
|
|
DEVSTAT_TYPE_ENCLOSURE = 0x00d,
|
|
|
|
DEVSTAT_TYPE_FLOPPY = 0x00e,
|
|
|
|
DEVSTAT_TYPE_MASK = 0x00f,
|
|
|
|
DEVSTAT_TYPE_IF_SCSI = 0x010,
|
|
|
|
DEVSTAT_TYPE_IF_IDE = 0x020,
|
|
|
|
DEVSTAT_TYPE_IF_OTHER = 0x030,
|
|
|
|
DEVSTAT_TYPE_IF_MASK = 0x0f0,
|
|
|
|
DEVSTAT_TYPE_PASS = 0x100
|
|
|
|
} devstat_type_flags;
|
|
|
|
.Ed
|
|
|
|
.Pp
|
Add a prioritization field to the devstat_add_entry() call so that
peripheral drivers can determine where in the devstat(9) list they are
inserted.
This requires recompilation of libdevstat, systat, vmstat, rpc.rstatd, and
any ports that depend on the devstat code, since the size of the devstat
structure has changed. The devstat version number has been incremented as
well to reflect the change.
This sorts devices in the devstat list in "more interesting" to "less
interesting" order. So, for instance, da devices are now more important
than floppy drives, and so will appear before floppy drives in the default
output from systat, iostat, vmstat, etc.
The order of devices is, for now, kept in a central table in devicestat.h.
If individual drivers were able to make a meaningful decision on what
priority they should be at attach time, we could consider splitting the
priority information out into the various drivers. For now, though, they
have no way of knowing that, so it's easier to put them in an easy to find
table.
Also, move the checkversion() call in vmstat(8) to a more logical place.
Thanks to Bruce and David O'Brien for suggestions, for reviewing this, and
for putting up with the long time it has taken me to commit it. Bruce did
object somewhat to the central priority table (he would rather the
priorities be distributed in each driver), so his objection is duly noted
here.
Reviewed by: bde, obrien
1999-02-10 00:04:13 +00:00
|
|
|
Devices have a priority associated with them, which controls roughly where
|
|
|
|
they are placed in the
|
2000-11-20 18:41:33 +00:00
|
|
|
.Nm
|
2003-10-23 01:54:06 +00:00
|
|
|
list.
|
|
|
|
The priorities are as follows:
|
Add a prioritization field to the devstat_add_entry() call so that
peripheral drivers can determine where in the devstat(9) list they are
inserted.
This requires recompilation of libdevstat, systat, vmstat, rpc.rstatd, and
any ports that depend on the devstat code, since the size of the devstat
structure has changed. The devstat version number has been incremented as
well to reflect the change.
This sorts devices in the devstat list in "more interesting" to "less
interesting" order. So, for instance, da devices are now more important
than floppy drives, and so will appear before floppy drives in the default
output from systat, iostat, vmstat, etc.
The order of devices is, for now, kept in a central table in devicestat.h.
If individual drivers were able to make a meaningful decision on what
priority they should be at attach time, we could consider splitting the
priority information out into the various drivers. For now, though, they
have no way of knowing that, so it's easier to put them in an easy to find
table.
Also, move the checkversion() call in vmstat(8) to a more logical place.
Thanks to Bruce and David O'Brien for suggestions, for reviewing this, and
for putting up with the long time it has taken me to commit it. Bruce did
object somewhat to the central priority table (he would rather the
priorities be distributed in each driver), so his objection is duly noted
here.
Reviewed by: bde, obrien
1999-02-10 00:04:13 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
typedef enum {
|
|
|
|
DEVSTAT_PRIORITY_MIN = 0x000,
|
|
|
|
DEVSTAT_PRIORITY_OTHER = 0x020,
|
|
|
|
DEVSTAT_PRIORITY_PASS = 0x030,
|
|
|
|
DEVSTAT_PRIORITY_FD = 0x040,
|
|
|
|
DEVSTAT_PRIORITY_WFD = 0x050,
|
Revamp the devstat priority system. All disks now have the same priority.
The same goes for CD drivers and tape drivers. In systems with mixed IDE
and SCSI, devices in the same priority class will be sorted in attach
order.
Also, the 'CCD' priority is now the 'ARRAY' priority, and a number of
drivers have been modified to use that priority.
This includes the necessary changes to all drivers, except the ATA drivers.
Soren will modify those separately.
This does not include and does not require any change in the devstat
version number, since no known userland applications use the priority
enumerations.
Reviewed by: msmith, sos, phk, jlemon, mjacob, bde
1999-12-08 04:45:23 +00:00
|
|
|
DEVSTAT_PRIORITY_TAPE = 0x060,
|
Add a prioritization field to the devstat_add_entry() call so that
peripheral drivers can determine where in the devstat(9) list they are
inserted.
This requires recompilation of libdevstat, systat, vmstat, rpc.rstatd, and
any ports that depend on the devstat code, since the size of the devstat
structure has changed. The devstat version number has been incremented as
well to reflect the change.
This sorts devices in the devstat list in "more interesting" to "less
interesting" order. So, for instance, da devices are now more important
than floppy drives, and so will appear before floppy drives in the default
output from systat, iostat, vmstat, etc.
The order of devices is, for now, kept in a central table in devicestat.h.
If individual drivers were able to make a meaningful decision on what
priority they should be at attach time, we could consider splitting the
priority information out into the various drivers. For now, though, they
have no way of knowing that, so it's easier to put them in an easy to find
table.
Also, move the checkversion() call in vmstat(8) to a more logical place.
Thanks to Bruce and David O'Brien for suggestions, for reviewing this, and
for putting up with the long time it has taken me to commit it. Bruce did
object somewhat to the central priority table (he would rather the
priorities be distributed in each driver), so his objection is duly noted
here.
Reviewed by: bde, obrien
1999-02-10 00:04:13 +00:00
|
|
|
DEVSTAT_PRIORITY_CD = 0x090,
|
Revamp the devstat priority system. All disks now have the same priority.
The same goes for CD drivers and tape drivers. In systems with mixed IDE
and SCSI, devices in the same priority class will be sorted in attach
order.
Also, the 'CCD' priority is now the 'ARRAY' priority, and a number of
drivers have been modified to use that priority.
This includes the necessary changes to all drivers, except the ATA drivers.
Soren will modify those separately.
This does not include and does not require any change in the devstat
version number, since no known userland applications use the priority
enumerations.
Reviewed by: msmith, sos, phk, jlemon, mjacob, bde
1999-12-08 04:45:23 +00:00
|
|
|
DEVSTAT_PRIORITY_DISK = 0x110,
|
|
|
|
DEVSTAT_PRIORITY_ARRAY = 0x120,
|
Add a prioritization field to the devstat_add_entry() call so that
peripheral drivers can determine where in the devstat(9) list they are
inserted.
This requires recompilation of libdevstat, systat, vmstat, rpc.rstatd, and
any ports that depend on the devstat code, since the size of the devstat
structure has changed. The devstat version number has been incremented as
well to reflect the change.
This sorts devices in the devstat list in "more interesting" to "less
interesting" order. So, for instance, da devices are now more important
than floppy drives, and so will appear before floppy drives in the default
output from systat, iostat, vmstat, etc.
The order of devices is, for now, kept in a central table in devicestat.h.
If individual drivers were able to make a meaningful decision on what
priority they should be at attach time, we could consider splitting the
priority information out into the various drivers. For now, though, they
have no way of knowing that, so it's easier to put them in an easy to find
table.
Also, move the checkversion() call in vmstat(8) to a more logical place.
Thanks to Bruce and David O'Brien for suggestions, for reviewing this, and
for putting up with the long time it has taken me to commit it. Bruce did
object somewhat to the central priority table (he would rather the
priorities be distributed in each driver), so his objection is duly noted
here.
Reviewed by: bde, obrien
1999-02-10 00:04:13 +00:00
|
|
|
DEVSTAT_PRIORITY_MAX = 0xfff
|
|
|
|
} devstat_priority;
|
|
|
|
.Ed
|
|
|
|
.Pp
|
1998-09-15 06:49:18 +00:00
|
|
|
Each device has associated with it flags to indicate what operations are
|
2003-10-23 01:54:06 +00:00
|
|
|
supported or not supported.
|
|
|
|
The
|
1998-09-15 06:49:18 +00:00
|
|
|
.Va devstat_support_flags
|
|
|
|
values are as follows:
|
|
|
|
.Bl -tag -width DEVSTAT_NO_ORDERED_TAGS
|
|
|
|
.It DEVSTAT_ALL_SUPPORTED
|
|
|
|
Every statistic type is supported by the device.
|
|
|
|
.It DEVSTAT_NO_BLOCKSIZE
|
|
|
|
This device does not have a blocksize.
|
|
|
|
.It DEVSTAT_NO_ORDERED_TAGS
|
|
|
|
This device does not support ordered tags.
|
|
|
|
.It DEVSTAT_BS_UNAVAILABLE
|
2003-10-23 01:54:06 +00:00
|
|
|
This device supports a blocksize, but it is currently unavailable.
|
|
|
|
This
|
1998-09-15 06:49:18 +00:00
|
|
|
flag is most often used with removable media drives.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
Transactions to a device fall into one of three categories, which are
|
|
|
|
represented in the
|
|
|
|
.Va flags
|
|
|
|
passed into
|
|
|
|
.Fn devstat_end_transaction .
|
|
|
|
The transaction types are as follows:
|
|
|
|
.Bd -literal -offset indent
|
2001-07-14 19:41:16 +00:00
|
|
|
typedef enum {
|
1998-09-15 06:49:18 +00:00
|
|
|
DEVSTAT_NO_DATA = 0x00,
|
|
|
|
DEVSTAT_READ = 0x01,
|
1999-09-22 20:27:21 +00:00
|
|
|
DEVSTAT_WRITE = 0x02,
|
|
|
|
DEVSTAT_FREE = 0x03
|
1998-09-15 06:49:18 +00:00
|
|
|
} devstat_trans_flags;
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
There are four possible values for the
|
|
|
|
.Va tag_type
|
|
|
|
argument to
|
|
|
|
.Fn devstat_end_transaction :
|
|
|
|
.Bl -tag -width DEVSTAT_TAG_ORDERED
|
|
|
|
.It DEVSTAT_TAG_SIMPLE
|
|
|
|
The transaction had a simple tag.
|
|
|
|
.It DEVSTAT_TAG_HEAD
|
|
|
|
The transaction had a head of queue tag.
|
|
|
|
.It DEVSTAT_TAG_ORDERED
|
|
|
|
The transaction had an ordered tag.
|
|
|
|
.It DEVSTAT_TAG_NONE
|
2005-02-13 22:25:33 +00:00
|
|
|
The device does not support tags.
|
1998-09-15 06:49:18 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The tag type values correspond to the lower four bits of the
|
|
|
|
.Tn SCSI
|
2003-10-23 01:54:06 +00:00
|
|
|
tag definitions.
|
|
|
|
In CAM, for instance, the
|
1998-09-15 06:49:18 +00:00
|
|
|
.Va tag_action
|
|
|
|
from the CCB is ORed with 0xf to determine the tag type to pass in to
|
|
|
|
.Fn devstat_end_transaction .
|
|
|
|
.Pp
|
|
|
|
There is a macro,
|
|
|
|
.Dv DEVSTAT_VERSION
|
|
|
|
that is defined in
|
2003-09-10 19:24:35 +00:00
|
|
|
.In sys/devicestat.h .
|
1998-09-15 06:49:18 +00:00
|
|
|
This is the current version of the
|
|
|
|
.Nm
|
|
|
|
subsystem, and it should be incremented each time a change is made that
|
|
|
|
would require recompilation of userland programs that access
|
|
|
|
.Nm
|
2003-10-23 01:54:06 +00:00
|
|
|
statistics.
|
|
|
|
Userland programs use this version, via the
|
1998-09-15 06:49:18 +00:00
|
|
|
.Va kern.devstat.version
|
|
|
|
.Nm sysctl
|
|
|
|
variable to determine whether they are in sync with the kernel
|
|
|
|
.Nm
|
|
|
|
structures.
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr systat 1 ,
|
|
|
|
.Xr devstat 3 ,
|
|
|
|
.Xr iostat 8 ,
|
|
|
|
.Xr rpc.rstatd 8 ,
|
|
|
|
.Xr vmstat 8
|
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
statistics system appeared in
|
|
|
|
.Fx 3.0 .
|
|
|
|
.Sh AUTHORS
|
2014-06-26 21:44:30 +00:00
|
|
|
.An Kenneth Merry Aq Mt ken@FreeBSD.org
|
1998-09-15 06:49:18 +00:00
|
|
|
.Sh BUGS
|
|
|
|
There may be a need for
|
|
|
|
.Fn spl
|
|
|
|
protection around some of the
|
|
|
|
.Nm
|
2010-08-28 16:32:01 +00:00
|
|
|
list manipulation code to ensure, for example, that the list of devices
|
1998-09-15 06:49:18 +00:00
|
|
|
is not changed while someone is fetching the
|
|
|
|
.Va kern.devstat.all
|
|
|
|
.Nm sysctl
|
|
|
|
variable.
|