.TH DMSTATS 8 "Jul 25 2015" "Linux" "MAINTENANCE COMMANDS" .SH NAME dmstats \(em device-mapper statistics management .SH SYNOPSIS .ad l .B dmsetup stats .I command .RB [ options ] .HP .PD 0 .B dmstats .RB < command > .RI [ device_name | \fB\-\-uuid .IR uuid | \fB\-\-major .I major .B \-\-minor .IR minor ] .HP .B dmstats clear .I device_name .RB [ \-\-allregions | \-\-regionid .IR id ] .HP .B dmstats create .I device_name .RB [ \-\-alldevices ] .RB [ \-\-areas .IR nr_areas | \fB\-\-areasize .IR area_size ] .RB [ \-\-bounds .IR histogram_boundaries ] .RB [ \-\-precise ] .RB [ \-\-start .I start_sector .B \-\-length .IR length | \fB\-\-segments ] .RB [ \-\-auxdata .IR data ] .RB [ \-\-programid .IR id ] .HP .B dmstats delete .I device_name .RB [ \-\-alldevices ] .RB [ \-\-allregions | \-\-regionid .IR id ] .RB [ \-\-allprograms | \-\-programid .IR id ] .HP .B dmstats help .RB [ \-c | \-C | \-\-columns ] .HP .B dmstats list .RI [ device_name ] .RB [ \-\-allprograms | \-\-programid .IR id ] .RB [ \-\-histogram ] .RB [ \-\-units .IR units ] .RB [ \-\-nosuffix ] .RB [ \-\-notimesuffix ] .RB [ \-v | \-\-verbose \ [ \-v | \-\-verbose ]] .HP .B dmstats print .RI [ device_name ] .RB [ \-\-clear ] .RB [ \-\-allprograms | \-\-programid .IR id ] .RB [ \-\-allregions | \-\-regionid .IR id ] .HP .B dmstats report .RI [ device_name ] .RB [ \-\-interval .IR seconds ] .RB [ \-\-count .IR count ] .RB [ \-\-units .IR units ] .RB [ \-\-histogram ] .RB [ \-\-allprograms ] .RB [ \-\-programid .IR id ] .RB [ \-\-regionid .IR id ] .RB [ \-O | \-\-sort .IR sort_fields ] .RB [ \-S | \-\-select .IR Selection ] .RB [ \-\-units .IR units ] .RB [ \-\-nosuffix ] .RB [ \-\-notimesuffix ] .PD .HP .ad b .SH DESCRIPTION The dmstats program manages IO statistics regions for devices that use the device-mapper driver. Statistics regions may be created, deleted, listed and reported on using the tool. The first argument to dmstats is a command. The second argument is the device name, uuid, or major and minor numbers. Further options permit the selection of regions, output format control, and reporting behaviour. When the program is run using the 'dmstats' alias, the command \fBmust\fP be the first argument and any switches and options should be specified following the command itself. This limitation is not present when run as 'dmsetup stats'. When no device argument is given dmstats will by default operate on all device-mapper devices present. The \fBcreate\fP and \fBdelete\fP commands require the use of \fB--alldevices\fP when used in this way. .SH OPTIONS .TP .B \-\-alldevices If no device arguments are given allow operation on all devices when creating or deleting regions. .TP .B \-\-allprograms Include regions from all program IDs for list and report operations. .TP .B \-\-allregions Include all present regions for commands that normally accept a single region identifier. .TP .B \-\-areas \fInr_areas Specify the number of statistics areas to create within a new region. .TP .B \-\-areasize \fIarea_size Specify the size of areas into which a new region should be divided. An optional suffix selects units of bBsSkKmMgGtTpPeE: (b)ytes, (s)ectors, (k)ilobytes, (m)egabytes, (g)igabytes, (t)erabytes, (p)etabytes, (e)xabytes. Capitalise to use multiples of 1000 (S.I.) instead of 1024. .TP .B \-\-auxdata \fIaux_data Specify auxilliary data (a string) to be stored with a new region. .TP .B \-\-clear When printing statistics counters, also atomically reset them to zero. .TP .B \-\-count \fIcount Specify the iteration count for repeating reports. If the count argument is zero reports will continue to repeat until interrupted. .TP .B \-\-bounds \fIhistogram_boundaries Specify the boundaries of a latency histogram to be tracked for the region as a comma separated list of latency values. Latency values are given in nanoseconds. An optional unit suffix of ns, us, ms, or s may be given after each value to specify units of nanoseconds, microseconds, miliseconds or seconds respectively. .TP .B \-\-histogram When used with the \fBreport\fP and \fBlist\fP commands select default fields that emphasize latency histogram data. .TP .B \-\-interval \fIseconds Specify the interval in seconds between successive iterations for repeating reports. If \-\-interval is specified but \-\-count is not, reports will continue to repeat until interrupted. .TP .B \-\-length \fIlength Specify the length of a new statistics region in sectors. An optional suffix selects units of bBsSkKmMgGtTpPeE: (b)ytes, (s)ectors, (k)ilobytes, (m)egabytes, (g)igabytes, (t)erabytes, (p)etabytes, (e)xabytes. Capitalise to use multiples of 1000 (S.I.) instead of 1024. .TP .BR \-j | \-\-major\ \fImajor Specify the major number. .TP .BR \-m | \-\-minor\ \fIminor Specify the minor number. .TP .B \-\-nosuffix Suppress the suffix on output sizes. Use with \fB\-\-units\fP (except h and H) if processing the output. .TP .B \-\-notimesuffix Suppress the suffix on output time values. Histogram boundary values will be reported in units of nanoseconds. .TP .BR \-o | \-\-options Specify which report fields to display. .TP .BR \-O | \-\-sort\ \fIsort_fields Sort output according to the list of fields given. Precede any sort_field with - for a reverse sort on that column. .TP .BR \-\-precise Attempt to use nanosecond precision counters when creating new statistics regions. .TP .B \-\-programid \fIid Specify a program ID string. When creating new statistics regions this string is stored with the region. Subsequent operations may supply a program ID in order to select only regions with a matching value. The default program ID for dmstats-managed regions is "dmstats". .TP .B \-\-regionid \fIid Specify the region to operate on. .TP .BR \-\-relative If displaying the histogram report show relative (percentage) values instead of absolute counts. .TP .BR \-S | \-\-select \ \fIselection Display only rows that match selection criteria. All rows with the additional "selected" column (-o selected) showing 1 if the row matches the selection and 0 otherwise. The selection criteria are defined by specifying column names and their valid values while making use of supported comparison operators. .TP .B \-\-start \fIstart Specify the start offset of a new statistics region in sectors. An optional suffix selects units of bBsSkKmMgGtTpPeE: (b)ytes, (s)ectors, (k)ilobytes, (m)egabytes, (g)igabytes, (t)erabytes, (p)etabytes, (e)xabytes. Capitalise to use multiples of 1000 (S.I.) instead of 1024. .TP .B \-\-segments Create a new statistics region for each target contained in the target device. This causes a separate region to be allocated for each segment of the device. .TP .BR \-\-units \ hHbBsSkKmMgGtTpPeE Set the display units for report output. All sizes are output in these units: (h)uman-readable, (b)ytes, (s)ectors, (k)ilobytes, (m)egabytes, (g)igabytes, (t)erabytes, (p)etabytes, (e)xabytes. Capitalise to use multiples of 1000 (S.I.) instead of 1024. Can also specify custom units e.g. \fB\-\-units 3M\fP .TP .BR \-u | \-\-uuid Specify the uuid. .TP .BR \-v | \-\-verbose \ [ \-v | \-\-verbose ] Produce additional output. .br .SH COMMANDS .TP .B clear .I device_name .RB [ \-\-allregions | \-\-regionid .IR id ] .RB [ \-\-allprograms .RB | .B \-\-programid .IR id ] .br Instructs the kernel to clear statistics counters for the speficied regions (with the exception of in-flight IO counters). .br .TP .B create .I device_name .RB [ \-\-areas .IR nr_areas ] .RB [ \-\-areasize .IR area_size ] .RB [ --bounds .IR histogram_boundaries ] .RB [ \-\-precise ] .RB [ \-\-start .I start_sector .B \-\-length .IR length | \fB\-\-segments ] .RB [ \-\-auxdata .IR data ] .RB [ \-\-programid .IR id ] .br Creates one or more new statistics regions on the specified device(s). The region will span the entire device unless \fB\-\-start\fP and \fB\-\-length\fP or \fB\-\-target\fP are given. The \fB\-\-start\fP and \fB\-\-length\fP options allow a region of arbitrary length to be placed at an arbitrary offset into the device. The \fB\-\-segments\fP option causes a new region to be created for each target in the corresponding device-mapper device's table. If the \fB\-\-precise\fP option is used the command will attempt to create a region using nanosecond precision counters. If \fB--bounds\fP is given a latency histogram will be tracked for the new region. The boundaries of the histogram bins are given as a comma separated list of latency values. There is an implicit lower bound of zero on the first bin and an implicit upper bound of infinity (or the configured interval duration) on the final bin. Latencies are given in nanoseconds. An optional unit suffix of ns, us, ms, or s may be given after each value to specify units of nanoseconds, microseconds, miliseconds or seconds respectively, so for example, 10ms is equivalent to 10000000. Latency values with a precision of less than one milisecond can only be used when precise timestamps are enabled: if \fB\-\-precise\fP is not given and values less than one milisecond are used it will be enabled automatically. An optional \fBprogram_id\fP or \fBaux_data\fP string may be associated with the region. A \fBprogram_id\fP may then be used to select regions for subsequent list, print, and report operations. The \fBaux_data\fP stores an arbitrary string and is not used by dmstats or the device-mapper kernel statistics subsystem. By default dmstats creates regions with a \fBprogram_id\fP of "dmstats". On success the \fBregion_id\fP of the newly created region is printed to stdout. .br .TP .B delete .RI [ device_name ] .RB [ \-\-alldevices ] .RB [ \-\-allregions | .B \-\-regionid .IR id ] .RB [ \-\-allprograms | \-\-programid .IR id ] .br Delete the specified statistics region. All counters and resources used by the region are released and the region will not appear in the output of subsequent list, print, or report operations. All regions registered on a device may be removed using \fB\-\-allregions\fP. To remove all regions on all devices both \fB--allregions\fP and \fB\-\-alldevices\fP must be used. .br .TP .B help .RB [ \-c | \-C | \-\-columns ] .br Outputs a summary of the commands available, optionally including the list of report fields. .br .TP .B list .RI [ device_name ] .RB [ \-\-histogram ] .RB [ \-\-allprograms ] .RB [ \-\-programid .IR id ] .RB [ \-v | \-\-verbose \ [ \-v | \-\-verbose ]] .br List the statistics regions registered on the device. If the \fB\-\-allprograms\fP switch is given all regions will be listed regardless of region program ID values. If \fB\-v\fP or \fB\-\-verbose\fP is given the report will include a row of information for each area contained in each region displayed. If \fB\-\-histogram\fP is given the report will include the bin count and latency boundary values for any configured histograms. .br .TP .B print .RB [ \-\-allregions | \-\-regionid .IR id ] .RB [ \-\-allprograms | \-\-programid .IR id ] .RB [ \-\-clear ] .br Print raw statistics counters for the specified region or for all present regions. .br .TP .B report .RB [ \-\-allprograms ] .RB [ \-\-interval .IR seconds ] .RB [ \-\-count .IR count ] .RB [ \-\-units .IR unit ] .RB [ \-\-regionid .IR id ] .RB [ \-\-programid .IR id ] .RB [ \-O | \-\-sort .IR sort_fields ] .RB [ \-S | \-\-select .IR selection ] .RB [ \-\-units .IR units ] .br Start a report for the specified region or for all present regions. If the count argument is specified, the report will repeat at a fixed interval set by the \fB\-\-interval\fP option. The default interval is one second. If the \fB\-\-allprograms\fP switch is given, all regions will be listed, regardless of region program ID values. If \fB\-\-histogram\fP is given the report will include the histogram values and latency boundaries. If \fB\-\-relative\fP is used the default histogram field displays bin values as a percentage of the total number of I/Os. .br .SH REGIONS AND AREAS The device-mapper statistics facility allows separate performance counters to be maintained for arbitrary regions of devices. A region may span any range: from a single sector to the whole device. A region may be further sub-divided into a number of distinct areas (one or more), each with its own counter set. By default new regions span the entire device. The \fB\-\-start\fP and \fB\-\-length\fP options allows a region of any size to be placed at any location on the device. A region may be either divided into the specified number of equal-sized areas, or into areas of the given size by specifying one of \fB\-\-areas\fP or \fB\-\-areasize\fP when creating a region with the \fBcreate\fP command. Depending on the size of the areas and the device region the final area within the region may be smaller than requested. .SS Region identifiers Each region is assigned an identifier when it is created that is used to reference the region in subsequent operations. Region identifiers are unique within a given device (including across different \fBprogram_id\fP values). .br Depending on the sequence of create and delete operations, gaps may exist in the sequence of \fBregion_id\fP values for a particular device. .SH REPORT FIELDS The dmstats report provides several types of field that may be added to the default field set, or used to create custom reports. .br All performance counters and metrics are calculated per-area. .br .SS Derived metrics A number of metrics fields are included that provide high level performance indicators. These are based on the fields provided by the conventional Linux iostat program and are derived from the basic counter values provided by the kernel for each area. .br .HP .B reads_merged_per_sec .br Reads merged per second. .HP .B writes_merged_per_sec .br Writes merged per second. .HP .B reads_per_sec .br Reads completed per second. .HP .B writes_per_sec .br Writes completed per second. .HP .B read_size_per_sec .br Size of data read per second. .HP .B write_size_per_sec .br Size of data written per second. .HP .B avg_request_size .br Average request size. .HP .B queue_size .br Average queue size. .HP .B await .br The average wait time for read and write operations. .HP .B r_await .br The average wait time for read operations. .HP .B w_await .br The average wait time for write operations. .HP .B throughput .br The device throughput in operations per second. .HP .B service_time .br The average service time (in milliseconds) for operations issued to the device. .HP .B util .br Percentage of CPU time during which I/O requests were issued to the device (bandwidth utilization for the device). Device saturation occurs when this value is close to 100%. .br .SS Region and area meta fields Meta fields provide information about the region or area that the statistics values relate to. This includes the region and area identifier, start, length, and counts, as well as the program ID and auxiliary data values. .br .HP .B region_id .br Region identifier. This is a non-negative integer returned by the kernel when a statistics region is created. .HP .B region_start .br .br The region start location. Display units are selected by the \fB--units\fP option. .HP .B region_len .br The length of the region. Display units are selected by the \fB--units\fP option. .HP .B area_id .br Area identifier. Area identifiers are assigned by the device-mapper statistics library and uniquely identify each area within a region. Each ID corresponds to a distinct set of performance counters for that area of the statistics region. Area identifiers are always monotonically increasing within a region so that higher ID values correspond to greater sector addresses within the area and no gaps in the sequence of identifiers exist. .HP .B area_start .br The area start location. Display units are selected by the \fB--units\fP option. .HP .B area_len .br The length of the area. Display units are selected by the \fB--units\fP option. .HP .B area_count .br The number of areas in this region. .HP .B program_id .br The program ID value associated with this region. .HP .B aux_data .br The auxiliary data value associated with this region. .br .HP .B interval_ns .br The estimated interval over which the current counter values have accumulated. The value is reported as an interger expressed in units of nanoseconds. .br .HP .B interval .br The estimated interval over which the current counter values have accumulated. The value is reported as a real number in units of seconds. .br .SS Basic counters Basic counters provide access to the raw counter data from the kernel, allowing further processing to be carried out by another program. The kernel provides thirteen separate counters for each statistics area. The first eleven of these match the counters provided in /proc/diskstats or /sys/block/*/*/stat. The final pair provide separate counters for read and write time. .P .HP .B read_count .br Count of reads completed this interval. .HP .B reads_merged_count .br Count of reads merged this interval. .HP .B read_sector_count .br Count of 512 byte sectors read this interval. .HP .B read_time .br Accumulated duration of all read requests (ns). .HP .B write_count .br Count of writes completed this interval. .HP .B writes_merged_count .br Count of writes merged this interval. .HP .B write_sector_count .br Count of 512 byte sectors written this interval. .HP .B write_nsecs .br Accumulated duration of all write requests (ns). .HP .B in_progress_count .br Count of requests currently in progress. .HP .B io_ticks .br Nanoseconds spent servicing requests. .HP .B queue_ticks .br This field is incremented at each I/O start, I/O completion, I/O merge, or read of these stats by the number of I/Os in progress multiplied by the number of milliseconds spent doing I/O since the last update of this field. This can provide an easy measure of both I/O completion time and the backlog that may be accumulating. .HP .B read_ticks .br Nanoseconds spent servicing reads. .HP .B write_ticks .br Nanoseconds spent servicing writes. .br .SS Histogram fields Histograms measure the frequency distribution of user specified I/O latency intervals. Histogram bin boundaries are specified when a region is created. A brief representation of the histogram values and latency intervals can be included in the report using these fields. .P .HP .B hist_count .br A list of the histogram counts for the current statistics area in order of ascending latency value. Each value represents the number of I/Os with latency times falling into that bin's time range during the sample period. .HP .B hist_count_bounds .br A list of the histogram counts for the current statistics area in order of ascending latency value including bin boundaries: each count is prefixed by the lower bound of the corresponding histogram bin. .HP .B hist_count_ranges .br A list of the histogram counts for the current statistics area in order of ascending latency value including bin boundaries: each count is prefixed by both the lower and upper bounds of the corresponding histogram bin. .HP .B hist_percent .br A list of the relative histogram values for the current statistics area in order of ascending latency value, expressed as a percentage. Each value represents the proportion of I/Os with latency times falling into that bin's time range during the sample period. .HP .B hist_percent_bounds .br A list of the relative histogram values for the current statistics area in order of ascending latency value, expressed as a percentage and including bin boundaries. Each value represents the proportion of I/Os with latency times falling into that bin's time range during the sample period and is prefixed with the corresponding bin's lower bound. .HP .B hist_percent_ranges .br A list of the relative histogram values for the current statistics area in order of ascending latency value, expressed as a percentage and including bin boundaries. Each value represents the proportion of I/Os with latency times falling into that bin's time range during the sample period and is prefixed with the corresponding bin's lower and upper bounds. .HP .B hist_bounds .br A list of the histogram boundary values for the current statistics area in order of ascending latency value. The values are expressed in whole units of seconds, miliseconds, microseconds or nanoseconds with a suffix indicating the unit. .HP .B hist_ranges .br A list of the histogram bin ranges for the current statistics area in order of ascending latency value. The values are expressed as "LOWER-UPPER" in whole units of seconds, miliseconds, microseconds or nanoseconds with a suffix indicating the unit. .HP .B hist_bins .br The number of latency histogram bins configured for the area. .br .br .P .SH EXAMPLES Create a whole-device region with one area on vg00/lvol1 .br .br # dmstats create vg00/lvol1 .br vg00/lvol1: Created new region with 1 area(s) as region ID 0 .br .br Create a 32M region 1G into device d0 .br .br # dmstats create --start 1G --length 32M d0 .br d0: Created new region with 1 area(s) as region ID 0 .br Create a whole-device region with 8 areas on every device .br .br # dmstats create --areas 8 .br vg00-lvol1: Created new region with 8 area(s) as region ID 0 .br vg00-lvol2: Created new region with 8 area(s) as region ID 0 .br vg00-lvol3: Created new region with 8 area(s) as region ID 0 .br vg01-lvol0: Created new region with 8 area(s) as region ID 2 .br vg01-lvol1: Created new region with 8 area(s) as region ID 0 .br vg00-lvol2: Created new region with 8 area(s) as region ID 1 .br .br Delete all regions on all devices .br .br # dmstats delete --alldevices --allregions .br .br Create a whole-device region with areas 10GiB in size on vg00/lvol1 using dmsetup .br .br # dmsetup stats create --areasize 10G vg00/lvol1 .br vg00-lvol1: Created new region with 5 area(s) as region ID 1 .br .br Create a 1GiB region with 16 areas at the start of vg00/lvol1 .br # dmstats create --start 0 --len 1G --areas=16 vg00/lvol1 .br vg00-lvol1: Created new region with 16 area(s) as region ID 0 .br .br List the statistics regions registered on vg00/lvol1 .br # dmstats list vg00/lvol1 .br Name RgID RStart RSize #Areas ASize ProgID .br vg00-lvol1 0 0 61.00g 1 61.00g dmstats .br vg00-lvol1 1 61.00g 19.20g 1 19.20g dmstats .br vg00-lvol1 2 80.20g 2.14g 1 2.14g dmstats .br .br Display five statistics reports for vg00/lvol1 at an interval of one second .br .br # dmstats report --interval 1 --count 5 vg00/lvol1 .br # dmstats report .br Name RgID ArID AStart ASize RRqM/s WRqM/s R/s W/s RSz/s WSz/s AvRqSz QSize Util% AWait RdAWa WrAWa .br vg_hex-lv_home 0 0 0 61.00g 0.00 0.00 0.00 218.00 0 1.04m 4.50k 2.97 81.70 13.62 0.00 13.62 .br vg_hex-lv_home 1 0 61.00g 19.20g 0.00 0.00 0.00 5.00 0 548.00k 109.50k 0.14 11.00 27.40 0.00 27.40 .br vg_hex-lv_home 2 0 80.20g 2.14g 0.00 0.00 0.00 14.00 0 1.15m 84.00k 0.39 18.70 27.71 0.00 27.71 .br .br Create one region for reach target contained in device vg00/lvol1 .br .br # dmstats create --segments vg00/lvol1 .br vg00-lvol1: Created new region with 1 area(s) as region ID 0 .br vg00-lvol1: Created new region with 1 area(s) as region ID 1 .br vg00-lvol1: Created new region with 1 area(s) as region ID 2 .br .br Print raw counters for region 4 on device d0 .br .br # dmstats print --regionid 4 d0 .br 2097152+65536 0 0 0 0 29 0 264 701 0 41 701 0 41 .br .br .SH AUTHORS Bryn M. Reeves .SH SEE ALSO .BR dmsetup (8) LVM2 resource page https://www.sourceware.org/lvm2/ .br Device-mapper resource page: http://sources.redhat.com/dm/ .br Device-mapper statistics kernel documentation .br Documentation/device-mapper/statistics.txt