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

Method readAllocationStats

btrfs/get.go:136–160  ·  view source on GitHub ↗

readAllocationStats reads Btrfs allocation data for the current path.

(d string)

Source from the content-addressed store, hash-verified

134
135// readAllocationStats reads Btrfs allocation data for the current path.
136func (r *reader) readAllocationStats(d string) (a *AllocationStats) {
137 // Create a reader for this subdirectory
138 sr := &reader{path: path.Join(r.path, d), devCount: r.devCount}
139
140 // Get the stats
141 a = &AllocationStats{
142 // Read basic allocation stats
143 MayUseBytes: sr.readValue("bytes_may_use"),
144 PinnedBytes: sr.readValue("bytes_pinned"),
145 ReadOnlyBytes: sr.readValue("bytes_readonly"),
146 ReservedBytes: sr.readValue("bytes_reserved"),
147 UsedBytes: sr.readValue("bytes_used"),
148 DiskUsedBytes: sr.readValue("disk_used"),
149 DiskTotalBytes: sr.readValue("disk_total"),
150 Flags: sr.readValue("flags"),
151 TotalBytes: sr.readValue("total_bytes"),
152 TotalPinnedBytes: sr.readValue("total_bytes_pinned"),
153 Layouts: sr.readLayouts(),
154 }
155
156 // Pass any error back
157 r.err = sr.err
158
159 return
160}
161
162// readLayouts reads all Btrfs layout statistics for the current path.
163func (r *reader) readLayouts() map[string]*LayoutUsage {

Callers 1

readFilesystemStatsMethod · 0.95

Calls 2

readValueMethod · 0.95
readLayoutsMethod · 0.95

Tested by

no test coverage detected