xfs.go 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. // Copyright 2017 The Prometheus Authors
  2. // Licensed under the Apache License, Version 2.0 (the "License");
  3. // you may not use this file except in compliance with the License.
  4. // You may obtain a copy of the License at
  5. //
  6. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. // Package xfs provides access to statistics exposed by the XFS filesystem.
  14. package xfs
  15. // Stats contains XFS filesystem runtime statistics, parsed from
  16. // /proc/fs/xfs/stat.
  17. //
  18. // The names and meanings of each statistic were taken from
  19. // http://xfs.org/index.php/Runtime_Stats and xfs_stats.h in the Linux
  20. // kernel source. Most counters are uint32s (same data types used in
  21. // xfs_stats.h), but some of the "extended precision stats" are uint64s.
  22. type Stats struct {
  23. ExtentAllocation ExtentAllocationStats
  24. AllocationBTree BTreeStats
  25. BlockMapping BlockMappingStats
  26. BlockMapBTree BTreeStats
  27. DirectoryOperation DirectoryOperationStats
  28. Transaction TransactionStats
  29. InodeOperation InodeOperationStats
  30. LogOperation LogOperationStats
  31. ReadWrite ReadWriteStats
  32. AttributeOperation AttributeOperationStats
  33. InodeClustering InodeClusteringStats
  34. Vnode VnodeStats
  35. Buffer BufferStats
  36. ExtendedPrecision ExtendedPrecisionStats
  37. }
  38. // ExtentAllocationStats contains statistics regarding XFS extent allocations.
  39. type ExtentAllocationStats struct {
  40. ExtentsAllocated uint32
  41. BlocksAllocated uint32
  42. ExtentsFreed uint32
  43. BlocksFreed uint32
  44. }
  45. // BTreeStats contains statistics regarding an XFS internal B-tree.
  46. type BTreeStats struct {
  47. Lookups uint32
  48. Compares uint32
  49. RecordsInserted uint32
  50. RecordsDeleted uint32
  51. }
  52. // BlockMappingStats contains statistics regarding XFS block maps.
  53. type BlockMappingStats struct {
  54. Reads uint32
  55. Writes uint32
  56. Unmaps uint32
  57. ExtentListInsertions uint32
  58. ExtentListDeletions uint32
  59. ExtentListLookups uint32
  60. ExtentListCompares uint32
  61. }
  62. // DirectoryOperationStats contains statistics regarding XFS directory entries.
  63. type DirectoryOperationStats struct {
  64. Lookups uint32
  65. Creates uint32
  66. Removes uint32
  67. Getdents uint32
  68. }
  69. // TransactionStats contains statistics regarding XFS metadata transactions.
  70. type TransactionStats struct {
  71. Sync uint32
  72. Async uint32
  73. Empty uint32
  74. }
  75. // InodeOperationStats contains statistics regarding XFS inode operations.
  76. type InodeOperationStats struct {
  77. Attempts uint32
  78. Found uint32
  79. Recycle uint32
  80. Missed uint32
  81. Duplicate uint32
  82. Reclaims uint32
  83. AttributeChange uint32
  84. }
  85. // LogOperationStats contains statistics regarding the XFS log buffer.
  86. type LogOperationStats struct {
  87. Writes uint32
  88. Blocks uint32
  89. NoInternalBuffers uint32
  90. Force uint32
  91. ForceSleep uint32
  92. }
  93. // ReadWriteStats contains statistics regarding the number of read and write
  94. // system calls for XFS filesystems.
  95. type ReadWriteStats struct {
  96. Read uint32
  97. Write uint32
  98. }
  99. // AttributeOperationStats contains statistics regarding manipulation of
  100. // XFS extended file attributes.
  101. type AttributeOperationStats struct {
  102. Get uint32
  103. Set uint32
  104. Remove uint32
  105. List uint32
  106. }
  107. // InodeClusteringStats contains statistics regarding XFS inode clustering
  108. // operations.
  109. type InodeClusteringStats struct {
  110. Iflush uint32
  111. Flush uint32
  112. FlushInode uint32
  113. }
  114. // VnodeStats contains statistics regarding XFS vnode operations.
  115. type VnodeStats struct {
  116. Active uint32
  117. Allocate uint32
  118. Get uint32
  119. Hold uint32
  120. Release uint32
  121. Reclaim uint32
  122. Remove uint32
  123. Free uint32
  124. }
  125. // BufferStats contains statistics regarding XFS read/write I/O buffers.
  126. type BufferStats struct {
  127. Get uint32
  128. Create uint32
  129. GetLocked uint32
  130. GetLockedWaited uint32
  131. BusyLocked uint32
  132. MissLocked uint32
  133. PageRetries uint32
  134. PageFound uint32
  135. GetRead uint32
  136. }
  137. // ExtendedPrecisionStats contains high precision counters used to track the
  138. // total number of bytes read, written, or flushed, during XFS operations.
  139. type ExtendedPrecisionStats struct {
  140. FlushBytes uint64
  141. WriteBytes uint64
  142. ReadBytes uint64
  143. }