github.com/hellobchain/third_party@v0.0.0-20230331131523-deb0478a2e52/prometheus/procfs/xfs/xfs.go (about)

     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  
    14  // Package xfs provides access to statistics exposed by the XFS filesystem.
    15  package xfs
    16  
    17  // Stats contains XFS filesystem runtime statistics, parsed from
    18  // /proc/fs/xfs/stat.
    19  //
    20  // The names and meanings of each statistic were taken from
    21  // http://xfs.org/index.php/Runtime_Stats and xfs_stats.h in the Linux
    22  // kernel source. Most counters are uint32s (same data types used in
    23  // xfs_stats.h), but some of the "extended precision stats" are uint64s.
    24  type Stats struct {
    25  	// The name of the filesystem used to source these statistics.
    26  	// If empty, this indicates aggregated statistics for all XFS
    27  	// filesystems on the host.
    28  	Name string
    29  
    30  	ExtentAllocation   ExtentAllocationStats
    31  	AllocationBTree    BTreeStats
    32  	BlockMapping       BlockMappingStats
    33  	BlockMapBTree      BTreeStats
    34  	DirectoryOperation DirectoryOperationStats
    35  	Transaction        TransactionStats
    36  	InodeOperation     InodeOperationStats
    37  	LogOperation       LogOperationStats
    38  	ReadWrite          ReadWriteStats
    39  	AttributeOperation AttributeOperationStats
    40  	InodeClustering    InodeClusteringStats
    41  	Vnode              VnodeStats
    42  	Buffer             BufferStats
    43  	ExtendedPrecision  ExtendedPrecisionStats
    44  }
    45  
    46  // ExtentAllocationStats contains statistics regarding XFS extent allocations.
    47  type ExtentAllocationStats struct {
    48  	ExtentsAllocated uint32
    49  	BlocksAllocated  uint32
    50  	ExtentsFreed     uint32
    51  	BlocksFreed      uint32
    52  }
    53  
    54  // BTreeStats contains statistics regarding an XFS internal B-tree.
    55  type BTreeStats struct {
    56  	Lookups         uint32
    57  	Compares        uint32
    58  	RecordsInserted uint32
    59  	RecordsDeleted  uint32
    60  }
    61  
    62  // BlockMappingStats contains statistics regarding XFS block maps.
    63  type BlockMappingStats struct {
    64  	Reads                uint32
    65  	Writes               uint32
    66  	Unmaps               uint32
    67  	ExtentListInsertions uint32
    68  	ExtentListDeletions  uint32
    69  	ExtentListLookups    uint32
    70  	ExtentListCompares   uint32
    71  }
    72  
    73  // DirectoryOperationStats contains statistics regarding XFS directory entries.
    74  type DirectoryOperationStats struct {
    75  	Lookups  uint32
    76  	Creates  uint32
    77  	Removes  uint32
    78  	Getdents uint32
    79  }
    80  
    81  // TransactionStats contains statistics regarding XFS metadata transactions.
    82  type TransactionStats struct {
    83  	Sync  uint32
    84  	Async uint32
    85  	Empty uint32
    86  }
    87  
    88  // InodeOperationStats contains statistics regarding XFS inode operations.
    89  type InodeOperationStats struct {
    90  	Attempts        uint32
    91  	Found           uint32
    92  	Recycle         uint32
    93  	Missed          uint32
    94  	Duplicate       uint32
    95  	Reclaims        uint32
    96  	AttributeChange uint32
    97  }
    98  
    99  // LogOperationStats contains statistics regarding the XFS log buffer.
   100  type LogOperationStats struct {
   101  	Writes            uint32
   102  	Blocks            uint32
   103  	NoInternalBuffers uint32
   104  	Force             uint32
   105  	ForceSleep        uint32
   106  }
   107  
   108  // ReadWriteStats contains statistics regarding the number of read and write
   109  // system calls for XFS filesystems.
   110  type ReadWriteStats struct {
   111  	Read  uint32
   112  	Write uint32
   113  }
   114  
   115  // AttributeOperationStats contains statistics regarding manipulation of
   116  // XFS extended file attributes.
   117  type AttributeOperationStats struct {
   118  	Get    uint32
   119  	Set    uint32
   120  	Remove uint32
   121  	List   uint32
   122  }
   123  
   124  // InodeClusteringStats contains statistics regarding XFS inode clustering
   125  // operations.
   126  type InodeClusteringStats struct {
   127  	Iflush     uint32
   128  	Flush      uint32
   129  	FlushInode uint32
   130  }
   131  
   132  // VnodeStats contains statistics regarding XFS vnode operations.
   133  type VnodeStats struct {
   134  	Active   uint32
   135  	Allocate uint32
   136  	Get      uint32
   137  	Hold     uint32
   138  	Release  uint32
   139  	Reclaim  uint32
   140  	Remove   uint32
   141  	Free     uint32
   142  }
   143  
   144  // BufferStats contains statistics regarding XFS read/write I/O buffers.
   145  type BufferStats struct {
   146  	Get             uint32
   147  	Create          uint32
   148  	GetLocked       uint32
   149  	GetLockedWaited uint32
   150  	BusyLocked      uint32
   151  	MissLocked      uint32
   152  	PageRetries     uint32
   153  	PageFound       uint32
   154  	GetRead         uint32
   155  }
   156  
   157  // ExtendedPrecisionStats contains high precision counters used to track the
   158  // total number of bytes read, written, or flushed, during XFS operations.
   159  type ExtendedPrecisionStats struct {
   160  	FlushBytes uint64
   161  	WriteBytes uint64
   162  	ReadBytes  uint64
   163  }