Linux "mpstat" Command Line Options and Examples
Report processors related statistics.

The mpstat command writes to standard output activities for each available processor, processor 0 being the first one. Global aver‐ age activities among all processors are also reported. The mpstat command can be used both on SMP and UP machines, but in the lat‐ ter, only global average activities will be printed.


Usage:

mpstat [ -A ] [ -n ] [ -u ] [ -V ] [ -I { keyword [,...] | ALL } ] [ -N { node_list | ALL } ] [ -o JSON ] [ -P { cpu_list | ON | ALL
    } ] [ interval [ count ] ]






Command Line Options:

-A
This option is equivalent to specifying -n -u -I ALL -N ALL -P ALL
mpstat -A ...
-I
Report interrupts statistics.Possible keywords are CPU, SCPU, and SUM.With the CPU keyword, the number of each individual interrupt received per second by the CPU or CPUs is displayed. Interruptsare those listed in /proc/interrupts file.With the SCPU keyword, the number of each individual software interrupt received per second by the CPU or CPUs is displayed.This option works only with kernels 2.6.31 and later. Software interrupts are those listed in /proc/softirqs file.With the SUM keyword, the mpstat command reports the total number of interrupts per processor. The following values are dis‐played:CPUProcessor number. The keyword all indicates that statistics are calculated as averages among all processors.intr/sShow the total number of interrupts received per second by the CPU or CPUs.The ALL keyword is equivalent to specifying all the keywords above and therefore all the interrupts statistics are displayed.
mpstat -I ...
-N
Indicate the NUMA nodes for which statistics are to be reported. node_list is a list of comma-separated values or range ofvalues (e.g., 0,2,4-7,12-). Note that node all is the global average among all nodes. The ALL keyword indicates that statis‐tics are to be reported for all nodes.
mpstat -N ...
-o
Display the statistics in JSON (Javascript Object Notation) format. JSON output field order is undefined, and new fields maybe added in the future.
mpstat -o ...
-P
Indicate the processors for which statistics are to be reported. cpu_list is a list of comma-separated values or range ofvalues (e.g., 0,2,4-7,12-). Note that processor 0 is the first processor, and processor all is the global average among allprocessors. The ON keyword indicates that statistics are to be reported for every online processor, whereas the ALL keywordindicates that statistics are to be reported for all processors.
mpstat -P ...
-u
CPUProcessor number. The keyword all indicates that statistics are calculated as averages among all processors.%usrShow the percentage of CPU utilization that occurred while executing at the user level (application).%niceShow the percentage of CPU utilization that occurred while executing at the user level with nice priority.%sysShow the percentage of CPU utilization that occurred while executing at the system level (kernel). Note that this doesnot include time spent servicing hardware and software interrupts.%iowaitShow the percentage of time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request.%irqShow the percentage of time spent by the CPU or CPUs to service hardware interrupts.%softShow the percentage of time spent by the CPU or CPUs to service software interrupts.%stealShow the percentage of time spent in involuntary wait by the virtual CPU or CPUs while the hypervisor was servicinganother virtual processor.%guestShow the percentage of time spent by the CPU or CPUs to run a virtual processor.%gniceShow the percentage of time spent by the CPU or CPUs to run a niced guest.%idleShow the percentage of time that the CPU or CPUs were idle and the system did not have an outstanding disk I/O request.Note: On SMP machines a processor that does not have any activity at all is a disabled (offline) processor.
mpstat -u ...
-V
ENVIRONMENTThe mpstat command takes into account the following environment variable:S_COLORSWhen this variable is set, display statistics in color on the terminal. Possible values for this variable are never, alwaysor auto (the latter is the default).Please note that the color (being red, yellow, or some other color) used to display a value is not indicative of any kind ofissue simply because of the color. It only indicates different ranges of values.S_COLORS_SGRSpecify the colors and other attributes used to display statistics on the terminal. Its value is a colon-separated list ofcapabilities that defaults to H=31;1:I=32;22:M=35;1:N=34;1:Z=34;22. Supported capabilities are:H= SGR (Select Graphic Rendition) substring for percentage values greater than or equal to 75%.I= SGR substring for CPU number.M= SGR substring for percentage values in the range from 50% to 75%.N= SGR substring for non-zero statistics values.Z= SGR substring for zero values.S_TIME_FORMATIf this variable exists and its value is ISO then the current locale will be ignored when printing the date in the reportheader. The mpstat command will use the ISO 8601 format (YYYY-MM-DD) instead. The timestamp will also be compliant with ISO8601 format.EXAMPLESmpstat 2 5Display five reports of global statistics among all processors at two second intervals.mpstat -P ALL 2 5Display five reports of statistics for all processors at two second intervals.BUGS/proc filesystem must be mounted for the mpstat command to work.Only a few activities are given by the Linux kernel for each processor.FILES/proc contains various files with system statistics.AUTHORSebastien Godard (sysstat <at> orange.fr)
mpstat -V ...