18c2ecf20Sopenharmony_ci===============================================
28c2ecf20Sopenharmony_ciBlock layer statistics in /sys/block/<dev>/stat
38c2ecf20Sopenharmony_ci===============================================
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ciThis file documents the contents of the /sys/block/<dev>/stat file.
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ciThe stat file provides several statistics about the state of block
88c2ecf20Sopenharmony_cidevice <dev>.
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciQ.
118c2ecf20Sopenharmony_ci   Why are there multiple statistics in a single file?  Doesn't sysfs
128c2ecf20Sopenharmony_ci   normally contain a single value per file?
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ciA.
158c2ecf20Sopenharmony_ci   By having a single file, the kernel can guarantee that the statistics
168c2ecf20Sopenharmony_ci   represent a consistent snapshot of the state of the device.  If the
178c2ecf20Sopenharmony_ci   statistics were exported as multiple files containing one statistic
188c2ecf20Sopenharmony_ci   each, it would be impossible to guarantee that a set of readings
198c2ecf20Sopenharmony_ci   represent a single point in time.
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ciThe stat file consists of a single line of text containing 11 decimal
228c2ecf20Sopenharmony_civalues separated by whitespace.  The fields are summarized in the
238c2ecf20Sopenharmony_cifollowing table, and described in more detail below.
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci=============== ============= =================================================
278c2ecf20Sopenharmony_ciName            units         description
288c2ecf20Sopenharmony_ci=============== ============= =================================================
298c2ecf20Sopenharmony_ciread I/Os       requests      number of read I/Os processed
308c2ecf20Sopenharmony_ciread merges     requests      number of read I/Os merged with in-queue I/O
318c2ecf20Sopenharmony_ciread sectors    sectors       number of sectors read
328c2ecf20Sopenharmony_ciread ticks      milliseconds  total wait time for read requests
338c2ecf20Sopenharmony_ciwrite I/Os      requests      number of write I/Os processed
348c2ecf20Sopenharmony_ciwrite merges    requests      number of write I/Os merged with in-queue I/O
358c2ecf20Sopenharmony_ciwrite sectors   sectors       number of sectors written
368c2ecf20Sopenharmony_ciwrite ticks     milliseconds  total wait time for write requests
378c2ecf20Sopenharmony_ciin_flight       requests      number of I/Os currently in flight
388c2ecf20Sopenharmony_ciio_ticks        milliseconds  total time this block device has been active
398c2ecf20Sopenharmony_citime_in_queue   milliseconds  total wait time for all requests
408c2ecf20Sopenharmony_cidiscard I/Os    requests      number of discard I/Os processed
418c2ecf20Sopenharmony_cidiscard merges  requests      number of discard I/Os merged with in-queue I/O
428c2ecf20Sopenharmony_cidiscard sectors sectors       number of sectors discarded
438c2ecf20Sopenharmony_cidiscard ticks   milliseconds  total wait time for discard requests
448c2ecf20Sopenharmony_ciflush I/Os      requests      number of flush I/Os processed
458c2ecf20Sopenharmony_ciflush ticks     milliseconds  total wait time for flush requests
468c2ecf20Sopenharmony_ci=============== ============= =================================================
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ciread I/Os, write I/Os, discard I/0s
498c2ecf20Sopenharmony_ci===================================
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ciThese values increment when an I/O request completes.
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ciflush I/Os
548c2ecf20Sopenharmony_ci==========
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ciThese values increment when an flush I/O request completes.
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ciBlock layer combines flush requests and executes at most one at a time.
598c2ecf20Sopenharmony_ciThis counts flush requests executed by disk. Not tracked for partitions.
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ciread merges, write merges, discard merges
628c2ecf20Sopenharmony_ci=========================================
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ciThese values increment when an I/O request is merged with an
658c2ecf20Sopenharmony_cialready-queued I/O request.
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ciread sectors, write sectors, discard_sectors
688c2ecf20Sopenharmony_ci============================================
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ciThese values count the number of sectors read from, written to, or
718c2ecf20Sopenharmony_cidiscarded from this block device.  The "sectors" in question are the
728c2ecf20Sopenharmony_cistandard UNIX 512-byte sectors, not any device- or filesystem-specific
738c2ecf20Sopenharmony_ciblock size.  The counters are incremented when the I/O completes.
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ciread ticks, write ticks, discard ticks, flush ticks
768c2ecf20Sopenharmony_ci===================================================
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ciThese values count the number of milliseconds that I/O requests have
798c2ecf20Sopenharmony_ciwaited on this block device.  If there are multiple I/O requests waiting,
808c2ecf20Sopenharmony_cithese values will increase at a rate greater than 1000/second; for
818c2ecf20Sopenharmony_ciexample, if 60 read requests wait for an average of 30 ms, the read_ticks
828c2ecf20Sopenharmony_cifield will increase by 60*30 = 1800.
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ciin_flight
858c2ecf20Sopenharmony_ci=========
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ciThis value counts the number of I/O requests that have been issued to
888c2ecf20Sopenharmony_cithe device driver but have not yet completed.  It does not include I/O
898c2ecf20Sopenharmony_cirequests that are in the queue but not yet issued to the device driver.
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ciio_ticks
928c2ecf20Sopenharmony_ci========
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ciThis value counts the number of milliseconds during which the device has
958c2ecf20Sopenharmony_cihad I/O requests queued.
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_citime_in_queue
988c2ecf20Sopenharmony_ci=============
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ciThis value counts the number of milliseconds that I/O requests have waited
1018c2ecf20Sopenharmony_cion this block device.  If there are multiple I/O requests waiting, this
1028c2ecf20Sopenharmony_civalue will increase as the product of the number of milliseconds times the
1038c2ecf20Sopenharmony_cinumber of requests waiting (see "read ticks" above for an example).
104