stat.rst 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. ===============================================
  2. Block layer statistics in /sys/block/<dev>/stat
  3. ===============================================
  4. This file documents the contents of the /sys/block/<dev>/stat file.
  5. The stat file provides several statistics about the state of block
  6. device <dev>.
  7. Q.
  8. Why are there multiple statistics in a single file? Doesn't sysfs
  9. normally contain a single value per file?
  10. A.
  11. 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. The stat file consists of a single line of text containing 17 decimal
  17. values separated by whitespace. The fields are summarized in the
  18. following table, and described in more detail below.
  19. =============== ============= =================================================
  20. Name units description
  21. =============== ============= =================================================
  22. read I/Os requests number of read I/Os processed
  23. read merges requests number of read I/Os merged with in-queue I/O
  24. read sectors sectors number of sectors read
  25. read ticks milliseconds total wait time for read requests
  26. write I/Os requests number of write I/Os processed
  27. write merges requests number of write I/Os merged with in-queue I/O
  28. write sectors sectors number of sectors written
  29. write ticks milliseconds total wait time for write requests
  30. in_flight requests number of I/Os currently in flight
  31. io_ticks milliseconds total time this block device has been active
  32. time_in_queue milliseconds total wait time for all requests
  33. discard I/Os requests number of discard I/Os processed
  34. discard merges requests number of discard I/Os merged with in-queue I/O
  35. discard sectors sectors number of sectors discarded
  36. discard ticks milliseconds total wait time for discard requests
  37. flush I/Os requests number of flush I/Os processed
  38. flush ticks milliseconds total wait time for flush requests
  39. =============== ============= =================================================
  40. read I/Os, write I/Os, discard I/0s
  41. ===================================
  42. These values increment when an I/O request completes.
  43. flush I/Os
  44. ==========
  45. These values increment when an flush I/O request completes.
  46. Block layer combines flush requests and executes at most one at a time.
  47. This counts flush requests executed by disk. Not tracked for partitions.
  48. read merges, write merges, discard merges
  49. =========================================
  50. These values increment when an I/O request is merged with an
  51. already-queued I/O request.
  52. read sectors, write sectors, discard_sectors
  53. ============================================
  54. These values count the number of sectors read from, written to, or
  55. discarded from this block device. The "sectors" in question are the
  56. standard UNIX 512-byte sectors, not any device- or filesystem-specific
  57. block size. The counters are incremented when the I/O completes.
  58. read ticks, write ticks, discard ticks, flush ticks
  59. ===================================================
  60. These values count the number of milliseconds that I/O requests have
  61. waited on this block device. If there are multiple I/O requests waiting,
  62. these values will increase at a rate greater than 1000/second; for
  63. example, if 60 read requests wait for an average of 30 ms, the read_ticks
  64. field will increase by 60*30 = 1800.
  65. in_flight
  66. =========
  67. This value counts the number of I/O requests that have been issued to
  68. the device driver but have not yet completed. It does not include I/O
  69. requests that are in the queue but not yet issued to the device driver.
  70. io_ticks
  71. ========
  72. This value counts the number of milliseconds during which the device has
  73. had I/O requests queued.
  74. time_in_queue
  75. =============
  76. This value counts the number of milliseconds that I/O requests have waited
  77. on this block device. If there are multiple I/O requests waiting, this
  78. value will increase as the product of the number of milliseconds times the
  79. number of requests waiting (see "read ticks" above for an example).