Stat returns information about current cpu/process statistics. See: https://www.kernel.org/doc/Documentation/filesystems/proc.txt
()
| 166 | // Stat returns information about current cpu/process statistics. |
| 167 | // See: https://www.kernel.org/doc/Documentation/filesystems/proc.txt |
| 168 | func (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. |
| 182 | func parseStat(r io.Reader, fileName string) (Stat, error) { |