Parse a softirq line.
(line string)
| 125 | |
| 126 | // Parse a softirq line. |
| 127 | func parseSoftIRQStat(line string) (SoftIRQStat, uint64, error) { |
| 128 | softIRQStat := SoftIRQStat{} |
| 129 | var total uint64 |
| 130 | var prefix string |
| 131 | |
| 132 | _, err := fmt.Sscanf(line, "%s %d %d %d %d %d %d %d %d %d %d %d", |
| 133 | &prefix, &total, |
| 134 | &softIRQStat.Hi, &softIRQStat.Timer, &softIRQStat.NetTx, &softIRQStat.NetRx, |
| 135 | &softIRQStat.Block, &softIRQStat.BlockIoPoll, |
| 136 | &softIRQStat.Tasklet, &softIRQStat.Sched, |
| 137 | &softIRQStat.Hrtimer, &softIRQStat.Rcu) |
| 138 | |
| 139 | if err != nil { |
| 140 | return SoftIRQStat{}, 0, fmt.Errorf("%w: couldn't parse %q (softirq): %w", ErrFileParse, line, err) |
| 141 | } |
| 142 | |
| 143 | return softIRQStat, total, nil |
| 144 | } |
| 145 | |
| 146 | // NewStat returns information about current cpu/process statistics. |
| 147 | // See https://www.kernel.org/doc/Documentation/filesystems/proc.txt |
no outgoing calls
no test coverage detected
searching dependent graphs…