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

Method Stat

stat.go:168–179  ·  view source on GitHub ↗

Stat returns information about current cpu/process statistics. See: https://www.kernel.org/doc/Documentation/filesystems/proc.txt

()

Source from the content-addressed store, hash-verified

166// Stat returns information about current cpu/process statistics.
167// See: https://www.kernel.org/doc/Documentation/filesystems/proc.txt
168func (fs FS) Stat() (Stat, error) {
169 fileName := fs.proc.Path("stat")
170 data, err := util.ReadFileNoStat(fileName)
171 if err != nil {
172 return Stat{}, err
173 }
174 procStat, err := parseStat(bytes.NewReader(data), fileName)
175 if err != nil {
176 return Stat{}, err
177 }
178 return procStat, nil
179}
180
181// parseStat parses the metrics from /proc/[pid]/stat.
182func parseStat(r io.Reader, fileName string) (Stat, error) {

Callers 15

NewStatFunction · 0.95
NewStatMethod · 0.95
TestStatFunction · 0.45
TestThreadStatFunction · 0.45
ThreadMethod · 0.45
ThreadMethod · 0.45
VMMethod · 0.45
TestProcStatFunction · 0.45
TestProcStatLimitsFunction · 0.45
testProcStatFunction · 0.45
ProcMethod · 0.45
FileDescriptorsLenMethod · 0.45

Calls 3

ReadFileNoStatFunction · 0.92
parseStatFunction · 0.85
PathMethod · 0.45

Tested by 6

TestStatFunction · 0.36
TestThreadStatFunction · 0.36
TestProcStatFunction · 0.36
TestProcStatLimitsFunction · 0.36
testProcStatFunction · 0.36
TestNVMeClassFunction · 0.36