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

Function vnodeStats

xfs/parse.go:374–401  ·  view source on GitHub ↗

VnodeStats builds a VnodeStats from a slice of uint32s.

(us []uint32)

Source from the content-addressed store, hash-verified

372
373// VnodeStats builds a VnodeStats from a slice of uint32s.
374func vnodeStats(us []uint32) (VnodeStats, error) {
375 // The attribute "Free" appears to not be available on older XFS
376 // stats versions. Therefore, 7 or 8 elements may appear in
377 // this slice.
378 l := len(us)
379 if l != 7 && l != 8 {
380 return VnodeStats{}, fmt.Errorf("incorrect number of values for XFS vnode stats: %d", l)
381 }
382
383 s := VnodeStats{
384 Active: us[0],
385 Allocate: us[1],
386 Get: us[2],
387 Hold: us[3],
388 Release: us[4],
389 Reclaim: us[5],
390 Remove: us[6],
391 }
392
393 // Skip adding free, unless it is present. The zero value will
394 // be used in place of an actual count.
395 if l == 7 {
396 return s, nil
397 }
398
399 s.Free = us[7]
400 return s, nil
401}
402
403// BufferStats builds a BufferStats from a slice of uint32s.
404func bufferStats(us []uint32) (BufferStats, error) {

Callers 1

ParseStatsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…