mpstat is a command-line utility from the sysstat package that reports processor utilization statistics for each CPU individually or as a system-wide average. In Linux monitoring, it answers a question that aggregate tools often hide: which logical CPUs are busy, and with what kind of work, so that an administrator can separate user code, kernel overhead, interrupt handling, storage waits and hypervisor contention.
Unlike top or htop, which focus on processes, mpstat focuses on processors as the unit of observation. It is lightweight, scriptable and available on almost every distribution, which makes it a standard first step when a multi-core server feels slow while the overall CPU average still looks moderate.
How mpstat collects processor statistics
mpstat reads cumulative tick counters from /proc/stat, the procfs file in which the kernel records how much time each CPU has spent in every execution state since boot. The counters are measured in clock ticks (USER_HZ, usually 100 per second), and mpstat converts them into percentages by sampling the file twice and dividing the difference between two snapshots by the elapsed time.
The basic syntax is mpstat [options] [interval [count]]. Run without an interval, it prints a single report of averages since system boot, which is rarely useful for diagnosing a current problem. With an interval such as mpstat -P ALL 2 5, it prints five reports two seconds apart and finishes with an Average line that summarizes the whole sampling window.
Interrupt statistics come from /proc/interrupts and /proc/softirqs, which mpstat parses when the -I option is given. Because all data comes from these kernel interfaces, mpstat needs no special privileges and adds negligible overhead, even at one-second intervals.
Reading the mpstat CPU columns
Each output row describes one CPU, or all CPUs together, for one interval, and the percentage columns always sum to roughly 100 percent. The following table explains what each column measures and what an unusually high value typically indicates.
| Column | What it measures | High values usually suggest |
|---|---|---|
| %usr | Time in user-space code at normal priority | Application computation, busy loops |
| %nice | User-space time at a lowered priority | Background batch jobs or builds |
| %sys | Time in kernel code, excluding interrupts | Heavy system calls, locking, memory management |
| %iowait | Idle time while block I/O was outstanding | Slow or saturated storage |
| %irq | Time servicing hardware interrupts | Network or storage interrupt storms |
| %soft | Time servicing softirqs | High packet rates, network stack processing |
| %steal | Time a virtual CPU waited for the hypervisor | Overcommitted host, noisy neighbors |
| %guest and %gnice | Time running a virtual CPU for guests | This host runs KVM virtual machines |
| %idle | Idle time with no outstanding I/O | Spare capacity on that CPU |
Two columns are frequently misread. %iowait is a form of idle time, not CPU work: it only shows that the CPU had nothing to run while a disk request was pending, so a busy system can show low iowait even when storage is slow. %steal only appears inside virtual machines and is the clearest evidence that the hypervisor, not the guest, is limiting performance.
Essential mpstat options
Most practical work with mpstat uses a small set of options that select processors, add interrupt data or change the output format. The table below lists the options that experienced administrators use most often.
| Option | Effect | Typical use |
|---|---|---|
-P ALL | Reports every logical CPU plus the all row | Detecting per-core imbalance |
-P 0,3 | Reports only the listed CPUs | Watching cores pinned to one workload |
-u | Reports CPU utilization only (the default) | Explicit scripts and documentation |
-I SUM | Total interrupts per second for each CPU | Quick interrupt load check |
-I CPU or -I SCPU | Per-interrupt or per-softirq rates | Finding which device floods one core |
-N or --dec | NUMA node selection, decimal places | Large multi-socket servers |
-A | Enables all reports for all CPUs | Collecting a complete snapshot |
-o JSON | Machine-readable JSON output | Feeding scripts or dashboards |
Option availability depends on the sysstat version: NUMA node reporting and some topology flags appeared only in releases from the 12.x series onward. On older enterprise distributions, man mpstat is the authoritative list for the installed build.
How mpstat compares with related monitoring tools
mpstat belongs to a family of sysstat and procps tools, and each answers a different question about system load. Choosing the right one avoids chasing symptoms in the wrong layer, as the comparison below shows.
| Tool | Primary unit of observation | Best question it answers |
|---|---|---|
| mpstat | Individual processors | Is the load evenly spread across cores |
| pidstat | Individual processes and threads | Which task consumes the CPU time |
| vmstat | Whole system: CPU, memory, run queue | Is the system short of CPU or memory |
| iostat | Block devices plus a CPU summary | Is a specific disk saturated |
| sar | Historical system-wide counters | What happened at 03:00 last night |
| top and htop | Interactive process list | What is running right now |
A useful workflow is top-down narrowing: vmstat or uptime shows that the system is under pressure, mpstat shows where across the cores the pressure sits, and pidstat or perf identifies the responsible task or function. The sar tool records the same per-CPU data historically through sar -P ALL, which makes mpstat the live counterpart of recorded sar data.
Diagnosing problems with mpstat
The real value of mpstat lies in recognizing patterns across CPUs rather than reading single numbers. The following decision table links common output patterns to their likely cause and the next diagnostic step.
| Observed pattern | Likely cause | Next step |
|---|---|---|
| One CPU near 100% usr, others idle | Single-threaded bottleneck | Use pidstat -t to find the hot thread |
| One CPU with high %soft or %irq | Interrupt affinity concentrated on one core | Check /proc/interrupts, enable RPS or irqbalance |
| High %iowait across all CPUs | Storage latency or saturation | Run iostat -x and inspect await |
| Sustained %steal above 5-10% | Hypervisor contention | Ask the provider or resize the instance |
| High %sys on many CPUs | Lock contention or excessive system calls | Profile with perf or trace with strace |
Thresholds such as steal above 5 to 10 percent are rules of thumb rather than standards; what matters is a sustained deviation from the normal baseline of the same workload. Capturing a baseline with mpstat -P ALL 5 during healthy periods makes later anomalies far easier to judge.
Limitations and common mistakes
mpstat reports time-based utilization, not how much useful work the processor completed, so it inherits several blind spots that practitioners should keep in mind.
- Logical CPUs are not physical cores: with simultaneous multithreading, two busy hyperthreads share one core, so 50 percent per-thread usage can already mean a saturated core.
- Frequency scaling is invisible: a CPU at 40 percent busy running at a reduced clock may be closer to its limit than the number suggests.
- Short intervals are noisy: sub-second spikes average out at five-second intervals, while one-second samples exaggerate random bursts.
- The first report without an interval is a boot average and should not be mistaken for current load.
- Container limits are not reflected: cgroup CPU quotas can throttle a container while mpstat on the host still shows idle cores; Pressure stall information is better suited to that case.
In plain words
Modern computers have many processors working side by side, a little like checkout lanes in a supermarket. The usual CPU figure tells you how busy the store is on average, but it cannot tell you that one lane has a long queue while the other seven stand empty.
mpstat shows every lane separately. For each processor it says how much time went to running programs, to the operating system itself, to waiting for the disk or to being idle. That makes it easy to see when one overloaded processor, rather than a lack of overall capacity, is slowing everything down.
A real-world example
An operations engineer manages a Linux web gateway with 16 logical CPUs that starts dropping requests during evening peaks, although the dashboard shows only about 20 percent average CPU usage. She runs mpstat -P ALL -I SUM 2 during the next peak and immediately sees that CPU 0 sits at 0 percent idle, with roughly 60 percent in %soft and 25 percent in %irq, while the other fifteen CPUs are mostly idle.
Inspecting /proc/interrupts confirms that every receive queue of the network card is bound to CPU 0. After enabling irqbalance and spreading the card queues across eight cores, the next mpstat run shows softirq time divided evenly at about 8 percent per core. Dropped requests disappear without any hardware upgrade, and the engineer adds a per-CPU mpstat check to the team runbook.