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

Method ProcStat

ext4/ext4.go:74–103  ·  view source on GitHub ↗

ProcStat returns stats for the filesystem.

()

Source from the content-addressed store, hash-verified

72
73// ProcStat returns stats for the filesystem.
74func (fs FS) ProcStat() ([]*Stats, error) {
75 matches, err := filepath.Glob(fs.sys.Path("fs/ext4/*"))
76 if err != nil {
77 return nil, err
78 }
79
80 stats := make([]*Stats, 0, len(matches))
81 for _, m := range matches {
82 s := &Stats{}
83
84 // "*" used in glob above indicates the name of the filesystem.
85 name := filepath.Base(m)
86 s.Name = name
87 for file, p := range map[string]*uint64{
88 "errors_count": &s.Errors,
89 "warning_count": &s.Warnings,
90 "msg_count": &s.Messages,
91 } {
92 var val uint64
93 val, err = parsers.ReadUintFromFile(fs.sys.Path(sysFSPath, sysFSExt4Path, name, file))
94 if err == nil {
95 *p = val
96 }
97 }
98
99 stats = append(stats, s)
100 }
101
102 return stats, nil
103}

Callers

nothing calls this directly

Calls 2

ReadUintFromFileFunction · 0.92
PathMethod · 0.45

Tested by

no test coverage detected