MCPcopy Create free account
hub / github.com/prometheus/procfs / stats

Method stats

bcache/get.go:67–89  ·  view source on GitHub ↗

stats retrieves bcache runtime statistics for each bcache and priorityStats flag controls if we need to read priority_stats.

(priorityStats bool)

Source from the content-addressed store, hash-verified

65// stats retrieves bcache runtime statistics for each bcache and
66// priorityStats flag controls if we need to read priority_stats.
67func (fs FS) stats(priorityStats bool) ([]*Stats, error) {
68 matches, err := filepath.Glob(fs.sys.Path("fs/bcache/*-*"))
69 if err != nil {
70 return nil, err
71 }
72
73 stats := make([]*Stats, 0, len(matches))
74 for _, uuidPath := range matches {
75 // "*-*" in glob above indicates the name of the bcache.
76 name := filepath.Base(uuidPath)
77
78 // stats
79 s, err := GetStats(uuidPath, priorityStats)
80 if err != nil {
81 return nil, err
82 }
83
84 s.Name = name
85 stats = append(stats, s)
86 }
87
88 return stats, nil
89}
90
91// ParsePseudoFloat parses the peculiar format produced by bcache's bch_hprint.
92func parsePseudoFloat(str string) (float64, error) {

Callers 2

StatsMethod · 0.95
StatsWithoutPriorityMethod · 0.95

Calls 2

GetStatsFunction · 0.70
PathMethod · 0.45

Tested by

no test coverage detected