mpstat
mpstat is a computer command-line software used in Unix-type operating systems to report (on the screen) processor-related statistics. It is used in computer monitoring in order to diagnose problems or to build statistics about a computer's CPU usage.
Description
The mpstat command writes to standard output activities for each available processor.
The mpstat command can be used both on SMP and UP machines, but in the latter, only global average activities will be printed.
Usage
$ mpstat <interval> <count>
Interval is the time in seconds between printing out a line of statistics. Count is the number of lines of output you want.
Note that the first line of output from mpstat (like iostat, vmstat, etc.) contains averages since system boot. The subsequent lines will show current values.
Examples
Different examples of output under different operating systems:
under Linux kernel 4.14 on a two CPU machine:
Linux 4.14.24.mptcp (hostname) 05/23/2018 _x86_64_ (2 CPU)
03:51:19 PM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
03:51:20 PM all 2.51 0.00 2.01 0.00 0.00 0.00 0.00 0.00 0.00 95.48
03:51:21 PM all 2.53 0.00 2.02 0.00 0.00 0.00 0.00 0.00 0.00 95.45
under Linux kernel 2.4:
$ mpstat
Linux 2.4.21-32.ELsmp (linux00) 07/04/07
10:26:54 CPU %user %nice %system %iowait %irq %soft %idle intr/s
10:26:54 all 0.07 0.00 0.16 8.48 0.00 0.09 91.18 165.49
under Solaris 11:
$ mpstat
CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
0 0 0 0 329 121 169 6 0 0 0 406 0 1 0 98
under AIX 6:
$ mpstat 1 1
System configuration: lcpu=8 ent=1.0 mode=Uncapped
cpu min maj mpc int cs ics rq mig lpa sysc us sy wa id pc %ec lcs
0 8 0 0 182 336 102 0 0 100 1434 38 51 0 12 0.02 1.8 185
1 0 0 0 11 5 5 0 0 - 0 0 19 0 81 0.00 0.1 12
2 0 0 0 1 0 0 0 0 - 0 0 42 0 58 0.00 0.0 0
3 0 0 0 1 0 0 0 0 - 0 0 43 0 57 0.00 0.0 0
4 0 0 0 1 0 0 0 0 - 0 0 45 0 55 0.00 0.0 0
5 0 0 0 1 0 0 0 0 - 0 0 44 0 56 0.00 0.0 0
6 0 0 0 1 0 0 0 0 - 0 0 2 0 98 0.00 0.0 0
7 0 0 0 53 5 5 0 0 - 0 0 66 0 34 0.00 0.2 54
U - - - - - - - - - - - - 0 99 0.99 99.0 -
ALL 8 0 0 251 346 112 0 0 100 1434 0 0 0 99 0.02 2.0 251