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

Function parsePriorityStats

bcache/get.go:221–247  ·  view source on GitHub ↗

ParsePriorityStats parses lines from the priority_stats file.

(line string, ps *PriorityStats)

Source from the content-addressed store, hash-verified

219
220// ParsePriorityStats parses lines from the priority_stats file.
221func parsePriorityStats(line string, ps *PriorityStats) error {
222 var (
223 value uint64
224 err error
225 )
226 switch {
227 case strings.HasPrefix(line, "Unused:"):
228 fields := strings.Fields(line)
229 rawValue := fields[len(fields)-1]
230 valueStr := strings.TrimSuffix(rawValue, "%")
231 value, err = strconv.ParseUint(valueStr, 10, 64)
232 if err != nil {
233 return err
234 }
235 ps.UnusedPercent = value
236 case strings.HasPrefix(line, "Metadata:"):
237 fields := strings.Fields(line)
238 rawValue := fields[len(fields)-1]
239 valueStr := strings.TrimSuffix(rawValue, "%")
240 value, err = strconv.ParseUint(valueStr, 10, 64)
241 if err != nil {
242 return err
243 }
244 ps.MetadataPercent = value
245 }
246 return nil
247}
248
249// ParseWritebackRateDebug parses lines from the writeback_rate_debug file.
250func parseWritebackRateDebug(line string, wrd *WritebackRateDebugStats) error {

Callers 2

TestPriorityStatsFunction · 0.85
getPriorityStatsMethod · 0.85

Calls

no outgoing calls

Tested by 1

TestPriorityStatsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…