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