mpstat(1)
Report processor-related statistics and monitor CPU performance in real-time.
Synopsis
mpstat [-A] [-n] [-u] [-P {cpu|ALL}] [interval [count]]Description
mpstat displays per-processor CPU statistics and average CPU statistics for the entire system. It reports user, system, I/O wait, and idle time percentages, helping identify CPU bottlenecks and load distribution across multiple processors.
By default, mpstat shows statistics since the last system boot. When an interval is specified, it reports statistics for that sampling period, with an optional count to repeat the measurement multiple times.
Common options
| Flag | What it does |
|---|---|
-A | Display all CPU statistics (equivalent to -u -I ALL -n) |
-u | Report CPU utilization (default: %user, %nice, %sys, %iowait, %irq, %soft, %idle) |
-I ALL | Report interrupts statistics for all interrupt types |
-P {cpu|ALL} | Show statistics for specific CPU (0, 1, etc.) or ALL processors |
-n | Display average CPU statistics since system startup |
-o JSON | Output statistics in JSON format |
-T | Display timestamp for each report |
Examples
Display average CPU statistics since system boot for all processors
mpstatShow CPU statistics every 1 second, 5 times total
mpstat 1 5Display per-CPU statistics for all processors, updated every 2 seconds
mpstat -P ALL 2Monitor CPU 0 only with 1-second intervals for 10 iterations
mpstat -P 0 1 10Show comprehensive CPU, interrupt, and network statistics every second
mpstat -A 1Display per-CPU stats with timestamps, 3 samples, 1-second interval
mpstat -T -P ALL 1 3