...

Source file src/github.com/prometheus/procfs/bcache/bcache.go

Documentation: github.com/prometheus/procfs/bcache

     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 bcache provides access to statistics exposed by the bcache (Linux
    15  // block cache).
    16  package bcache
    17  
    18  // Stats contains bcache runtime statistics, parsed from /sys/fs/bcache/.
    19  //
    20  // The names and meanings of each statistic were taken from bcache.txt and
    21  // files in drivers/md/bcache in the Linux kernel source. Counters are uint64
    22  // (in-kernel counters are mostly unsigned long).
    23  type Stats struct {
    24  	// The name of the bcache used to source these statistics.
    25  	Name   string
    26  	Bcache BcacheStats
    27  	Bdevs  []BdevStats
    28  	Caches []CacheStats
    29  }
    30  
    31  // BcacheStats contains statistics tied to a bcache ID.
    32  type BcacheStats struct { // nolint:revive
    33  	AverageKeySize        uint64
    34  	BtreeCacheSize        uint64
    35  	CacheAvailablePercent uint64
    36  	Congested             uint64
    37  	RootUsagePercent      uint64
    38  	TreeDepth             uint64
    39  	Internal              InternalStats
    40  	FiveMin               PeriodStats
    41  	Total                 PeriodStats
    42  }
    43  
    44  // BdevStats contains statistics for one backing device.
    45  type BdevStats struct {
    46  	Name               string
    47  	DirtyData          uint64
    48  	FiveMin            PeriodStats
    49  	Total              PeriodStats
    50  	WritebackRateDebug WritebackRateDebugStats
    51  }
    52  
    53  // CacheStats contains statistics for one cache device.
    54  type CacheStats struct {
    55  	Name            string
    56  	IOErrors        uint64
    57  	MetadataWritten uint64
    58  	Written         uint64
    59  	Priority        PriorityStats
    60  }
    61  
    62  // PriorityStats contains statistics from the priority_stats file.
    63  type PriorityStats struct {
    64  	UnusedPercent   uint64
    65  	MetadataPercent uint64
    66  }
    67  
    68  // InternalStats contains internal bcache statistics.
    69  type InternalStats struct {
    70  	ActiveJournalEntries                uint64
    71  	BtreeNodes                          uint64
    72  	BtreeReadAverageDurationNanoSeconds uint64
    73  	CacheReadRaces                      uint64
    74  }
    75  
    76  // PeriodStats contains statistics for a time period (5 min or total).
    77  type PeriodStats struct {
    78  	Bypassed            uint64
    79  	CacheBypassHits     uint64
    80  	CacheBypassMisses   uint64
    81  	CacheHits           uint64
    82  	CacheMissCollisions uint64
    83  	CacheMisses         uint64
    84  	CacheReadaheads     uint64
    85  }
    86  
    87  // WritebackRateDebugStats contains bcache writeback statistics.
    88  type WritebackRateDebugStats struct {
    89  	Rate         uint64
    90  	Dirty        uint64
    91  	Target       uint64
    92  	Proportional int64
    93  	Integral     int64
    94  	Change       int64
    95  	NextIO       int64
    96  }
    97  

View as plain text