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

Function parseNFSBytesStats

mountstats.go:464–489  ·  view source on GitHub ↗

parseNFSBytesStats parses a NFSBytesStats line using an input set of integer fields.

(ss []string)

Source from the content-addressed store, hash-verified

462// parseNFSBytesStats parses a NFSBytesStats line using an input set of
463// integer fields.
464func parseNFSBytesStats(ss []string) (*NFSBytesStats, error) {
465 if len(ss) != fieldBytesLen {
466 return nil, fmt.Errorf("%w: Invalid NFS bytes stats: %v", ErrFileParse, ss)
467 }
468
469 ns := make([]uint64, 0, fieldBytesLen)
470 for _, s := range ss {
471 n, err := strconv.ParseUint(s, 10, 64)
472 if err != nil {
473 return nil, err
474 }
475
476 ns = append(ns, n)
477 }
478
479 return &NFSBytesStats{
480 Read: ns[0],
481 Write: ns[1],
482 DirectRead: ns[2],
483 DirectWrite: ns[3],
484 ReadTotal: ns[4],
485 WriteTotal: ns[5],
486 ReadPages: ns[6],
487 WritePages: ns[7],
488 }, nil
489}
490
491// parseNFSEventsStats parses a NFSEventsStats line using an input set of
492// integer fields.

Callers 1

parseMountStatsNFSFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected