Andy Isaacson | 37a3279 | 2006-01-08 01:04:00 -0800 | [diff] [blame] | 1 | Block layer statistics in /sys/block/<dev>/stat |
| 2 | =============================================== |
| 3 | |
| 4 | This file documents the contents of the /sys/block/<dev>/stat file. |
| 5 | |
| 6 | The stat file provides several statistics about the state of block |
| 7 | device <dev>. |
| 8 | |
| 9 | Q. Why are there multiple statistics in a single file? Doesn't sysfs |
| 10 | normally contain a single value per file? |
| 11 | A. By having a single file, the kernel can guarantee that the statistics |
| 12 | represent a consistent snapshot of the state of the device. If the |
| 13 | statistics were exported as multiple files containing one statistic |
| 14 | each, it would be impossible to guarantee that a set of readings |
| 15 | represent a single point in time. |
| 16 | |
| 17 | The stat file consists of a single line of text containing 11 decimal |
| 18 | values separated by whitespace. The fields are summarized in the |
| 19 | following table, and described in more detail below. |
| 20 | |
| 21 | Name units description |
| 22 | ---- ----- ----------- |
| 23 | read I/Os requests number of read I/Os processed |
| 24 | read merges requests number of read I/Os merged with in-queue I/O |
| 25 | read sectors sectors number of sectors read |
| 26 | read ticks milliseconds total wait time for read requests |
| 27 | write I/Os requests number of write I/Os processed |
| 28 | write merges requests number of write I/Os merged with in-queue I/O |
| 29 | write sectors sectors number of sectors written |
| 30 | write ticks milliseconds total wait time for write requests |
| 31 | in_flight requests number of I/Os currently in flight |
| 32 | io_ticks milliseconds total time this block device has been active |
| 33 | time_in_queue milliseconds total wait time for all requests |
Michael Callahan | bdca3c8 | 2018-07-18 04:47:40 -0700 | [diff] [blame] | 34 | discard I/Os requests number of discard I/Os processed |
| 35 | discard merges requests number of discard I/Os merged with in-queue I/O |
| 36 | discard sectors sectors number of sectors discarded |
| 37 | discard ticks milliseconds total wait time for discard requests |
Andy Isaacson | 37a3279 | 2006-01-08 01:04:00 -0800 | [diff] [blame] | 38 | |
Michael Callahan | bdca3c8 | 2018-07-18 04:47:40 -0700 | [diff] [blame] | 39 | read I/Os, write I/Os, discard I/0s |
| 40 | =================================== |
Andy Isaacson | 37a3279 | 2006-01-08 01:04:00 -0800 | [diff] [blame] | 41 | |
| 42 | These values increment when an I/O request completes. |
| 43 | |
Michael Callahan | bdca3c8 | 2018-07-18 04:47:40 -0700 | [diff] [blame] | 44 | read merges, write merges, discard merges |
| 45 | ========================================= |
Andy Isaacson | 37a3279 | 2006-01-08 01:04:00 -0800 | [diff] [blame] | 46 | |
| 47 | These values increment when an I/O request is merged with an |
| 48 | already-queued I/O request. |
| 49 | |
Michael Callahan | bdca3c8 | 2018-07-18 04:47:40 -0700 | [diff] [blame] | 50 | read sectors, write sectors, discard_sectors |
| 51 | ============================================ |
Andy Isaacson | 37a3279 | 2006-01-08 01:04:00 -0800 | [diff] [blame] | 52 | |
Michael Callahan | bdca3c8 | 2018-07-18 04:47:40 -0700 | [diff] [blame] | 53 | These values count the number of sectors read from, written to, or |
| 54 | discarded from this block device. The "sectors" in question are the |
| 55 | standard UNIX 512-byte sectors, not any device- or filesystem-specific |
| 56 | block size. The counters are incremented when the I/O completes. |
Andy Isaacson | 37a3279 | 2006-01-08 01:04:00 -0800 | [diff] [blame] | 57 | |
Michael Callahan | bdca3c8 | 2018-07-18 04:47:40 -0700 | [diff] [blame] | 58 | read ticks, write ticks, discard ticks |
| 59 | ====================================== |
Andy Isaacson | 37a3279 | 2006-01-08 01:04:00 -0800 | [diff] [blame] | 60 | |
| 61 | These values count the number of milliseconds that I/O requests have |
| 62 | waited on this block device. If there are multiple I/O requests waiting, |
| 63 | these values will increase at a rate greater than 1000/second; for |
| 64 | example, if 60 read requests wait for an average of 30 ms, the read_ticks |
| 65 | field will increase by 60*30 = 1800. |
| 66 | |
| 67 | in_flight |
| 68 | ========= |
| 69 | |
| 70 | This value counts the number of I/O requests that have been issued to |
| 71 | the device driver but have not yet completed. It does not include I/O |
| 72 | requests that are in the queue but not yet issued to the device driver. |
| 73 | |
| 74 | io_ticks |
| 75 | ======== |
| 76 | |
| 77 | This value counts the number of milliseconds during which the device has |
| 78 | had I/O requests queued. |
| 79 | |
| 80 | time_in_queue |
| 81 | ============= |
| 82 | |
| 83 | This value counts the number of milliseconds that I/O requests have waited |
| 84 | on this block device. If there are multiple I/O requests waiting, this |
| 85 | value will increase as the product of the number of milliseconds times the |
| 86 | number of requests waiting (see "read ticks" above for an example). |