FreeBSD Bugzilla – Attachment 115547 Details for
Bug 157316
[patch] update devstat(9) man page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
devstat.9.diff
devstat.9.diff (text/x-patch; charset=US-ASCII), 7.33 KB, created by
pluknet
on 2011-05-25 14:04:15 UTC
(
hide
)
Description:
devstat.9.diff
Filename:
MIME Type:
Creator:
pluknet
Created:
2011-05-25 14:04:15 UTC
Size:
7.33 KB
patch
obsolete
>Index: devstat.9 >=================================================================== >--- devstat.9 (revision 222032) >+++ devstat.9 (working copy) >@@ -27,23 +27,23 @@ > .\" > .\" $FreeBSD$ > .\" >-.Dd May 22, 1998 >+.Dd May 22, 2011 > .Dt DEVSTAT 9 > .Os > .Sh NAME > .Nm devstat , >-.Nm devstat_add_entry , > .Nm devstat_end_transaction , > .Nm devstat_end_transaction_bio , >+.Nm devstat_new_entry , > .Nm devstat_remove_entry , >-.Nm devstat_start_transaction >+.Nm devstat_start_transaction , >+.Nm devstat_start_transaction_bio > .Nd kernel interface for keeping device statistics > .Sh SYNOPSIS > .In sys/devicestat.h >-.Ft void >-.Fo devstat_add_entry >-.Fa "struct devstat *ds" >-.Fa "const char *dev_name" >+.Ft "struct devstat *" >+.Fo devstat_new_entry >+.Fa "const void *dev_name" > .Fa "int unit_number" > .Fa "u_int32_t block_size" > .Fa "devstat_support_flags flags" >@@ -53,13 +53,17 @@ > .Ft void > .Fn devstat_remove_entry "struct devstat *ds" > .Ft void >-.Fn devstat_start_transaction "struct devstat *ds" >+.Fn devstat_start_transaction "struct devstat *ds" "struct bintime *now" > .Ft void >+.Fn devstat_start_transaction_bio "struct devstat *ds" "struct bio *bp" >+.Ft void > .Fo devstat_end_transaction > .Fa "struct devstat *ds" > .Fa "u_int32_t bytes" > .Fa "devstat_tag_type tag_type" > .Fa "devstat_trans_flags flags" >+.Fa "struct bintime *now" >+.Fa "struct bintime *then" > .Fc > .Ft void > .Fo devstat_end_transaction_bio >@@ -77,19 +81,14 @@ > code. > Instead, that is left for user programs to handle. > .Pp >-.Fn devstat_add_entry >+.Fn devstat_new_entry > registers a device with the > .Nm >-subsystem. >-The caller is expected to have already allocated \fBand zeroed\fR >-the devstat structure before calling this function. >-.Fn devstat_add_entry >-takes several arguments: >+subsystem and returns a pointer to the allocated and initialized >+.Va devstat >+structure. >+It takes several arguments: > .Bl -tag -width device_type >-.It ds >-The >-.Va devstat >-structure, allocated and zeroed by the client. > .It dev_name > The device name, e.g.\& da, cd, sa. > .It unit_number >@@ -127,7 +126,7 @@ > .Nm > subsystem. > It takes the devstat structure for the device in question as >-an argument. >+an argument and frees used memory back to the system. > The > .Nm > generation number is incremented and the number of devices is decremented. >@@ -136,18 +135,23 @@ > registers the start of a transaction with the > .Nm > subsystem. >-The busy count is incremented with each transaction start. >+The start count is incremented with each transaction start. > When a device goes from idle to busy, the system uptime is recorded in the >-.Va start_time >+.Va busy_from > field of the > .Va devstat > structure. >+The caller can override the time value by specifying a non-NULL >+timestamp argument >+.Va now >+to the function. > .Pp > .Fn devstat_end_transaction > registers the end of a transaction with the > .Nm > subsystem. >-It takes four arguments: >+The end count is incremented with each transaction end. >+It takes several arguments: > .Bl -tag -width tag_type > .It ds > The >@@ -161,12 +165,21 @@ > .It flags > Transaction flags indicating whether the transaction was a read, write, or > whether no data was transferred. >+.It now >+The current timestamp. >+.It then >+The timestamp of when this transaction started. > .El > .Pp >+.Fn devstat_start_transaction_bio >+and > .Fn devstat_end_transaction_bio >-is a wrapper for >+are wrappers for >+.Fn devstat_start_transaction >+and > .Fn devstat_end_transaction >-which pulls all the information from a >+respectively >+which pull all the information from a > .Va "struct bio" > which is ready for biodone(). > .Pp >@@ -201,68 +214,45 @@ > .It unit_number > The unit number identifies the particular instance of the peripheral driver > in question. >-.It bytes_written >-This is the number of bytes that have been written to the device. >+.It bytes[flags] >+This is the number of bytes that have been written, read or freed/erased on >+the device according to a transaction type specified in flags index. >+See below for transaction types. > This number is currently an unsigned 64 bit integer. > This will hopefully > eliminate the counter wrap that would come very quickly on some systems if > 32 bit integers were used. >-.It bytes_read >-This is the number of bytes that have been read from the device. >-.It bytes_freed >-This is the number of bytes that have been freed/erased on the device. >-.It num_reads >-This is the number of reads from the device. >-.It num_writes >-This is the number of writes to the device. >-.It num_frees >-This is the number of free/erase operations on the device. >-.It num_other >-This is the number of transactions to the device which are neither reads or >-writes. >-For instance, >-.Tn SCSI >-drivers often send a test unit ready command to >-.Tn SCSI >-devices. >-The test unit ready command does not read or write any data. >-It merely causes the device to return its status. >-.It busy_count >-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 in >-the way >+.It operations[flags] >+This is the number of read, write or free/erase operations on the device >+according to a transaction type specified in flags index. >+.It duration[[flags] >+The duration of read, write or free/erase operations on the device >+according to a transaction type specified in flags index. >+.It start_count , end_count >+This are numbers of started and completed transactions for the device, >+which are updated in the > .Fn devstat_start_transaction > and > .Fn devstat_end_transaction >-are being called in client code. >-There should be one and only one >-transaction start event and one transaction end event for each transaction. >+paths respectively. >+On an idle device their values should be equal. > .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 > are sent to a device. > See below for a list of tag types. >-.It dev_creation_time >+.It creation_time > This is the time, as reported by >-.Fn getmicrotime >+.Fn binuptime > that the device was registered. > .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 start_time >-This is the time, as reported by >-.Fn getmicrouptime >-that the device busy count went from zero to one. >-.It last_comp_time >-This is the time as reported by >-.Fn getmicrouptime >-that a transaction last completed. >-It is used along with >-.Va start_time >-to calculate the device busy time. >+This is the amount of time that the device was busy. >+This is only updated during the ending of a transaction. >+.It busy_from >+This is the system time, as reported by >+.Xr binuptime >+when starting a transaction of a device that goes from idle to busy. > .It flags > These flags indicate which statistics measurements are supported by a > particular device. >@@ -378,8 +368,19 @@ > DEVSTAT_WRITE = 0x02, > DEVSTAT_FREE = 0x03 > } devstat_trans_flags; >+#define DEVSTAT_N_TRANS_FLAGS 4 > .Ed > .Pp >+DEVSTAT_NO_DATA is a type of transactions to the device which are neither >+reads or writes. >+For instance, >+.Tn SCSI >+drivers often send a test unit ready command to >+.Tn SCSI >+devices. >+The test unit ready command does not read or write any data. >+It merely causes the device to return its status. >+.Pp > There are four possible values for the > .Va tag_type > argument to
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 157316
:
115546
| 115547