
The authoritative documentation is, of course, the source code.

The fields are user, nice, system, idle, iowait, irq, softirq, steal, guest, and guest_nice. The units are typically hundredths of a second. When you see the line that start with intr, you know to stop parsing.Įach number is the amount of time the CPU has spent in a particular state. The first line is aggregate for all cores.

You'll need to read it twice, a measured time apart, and subtract the first set of numbers from the second. You want to read the first few lines of /proc/stat.
