Introduction
Mpstat is the abbreviation of multiprocessor statistics and is a real-time system monitoring tool. Some statistical information about its report and CPU, which is stored in the/proc/stat file. In a multi-CPUs system, it not only can view the average status information of all CPUs, but also can view the information of specific CPU. Mpstat's biggest feature is the ability to view statistics for each compute core in a multi-core CPU, while a tool like Vmstat can only view the overall CPU of the system.
Grammar
Mpstat [-P {| All}] [internal [count]] parameter explanation-P {| All} indicates which CPU is monitored, the CPU is internal in [0,cpu number 1], the interval between two samples adjacent, count samples, count can only be used with delay when there are no parameters, The Mpstat displays the average of all information after the system starts. When there is interval, the first line of information is the average information since the system started. Starting with the second line, the output is the average information for the previous interval time period.
Example
View current health information for multicore CPU cores, updated every 2 seconds
Mpstat 219:45:12 CPU%usr%nice%sys%iowait%irq%soft%steal%guest%idle19:45:14 all 0.04 0.00 0.00 0.00 0.00 0.00 0.00 0.00 99.9619:45:16 All 0.00 0.00 0.00 0.03 0.00 0.00 0.00 0.00 99.9719:45:18 All 0.00 0.07 0.07 0.00 0.00 0.00 0.00 0 .00 99.87
If you want to see detailed current health information for each CPU core, the output is as follows:
Mpstat- p all 219:43:58 CPU %usr %nice %sys %iowait%irq%soft%steal%guest %idle19:43:59 All 0.00 0.00 0.04 0.00 0.00 0.00 0.00 0.00 99.9619:43:59 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.0019:43:59 1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00.......19:43:59 0.99 0.00 0.00 0.00 0.00 0.00 0.00 0.00 99.0119:43:59 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.0019:43:59 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
The meaning of the field is as follows
%user in internal time period, the user State CPU time (%), does not contain the Nice value is negative process (usr/total) *100%nice in internal time period, nice value is the CPU time of the negative process ( %) (nice/total) *100%sys in internal time period, kernel time (%) (system/total) *100%iowait in internal time period, hard disk IO wait time (%) (iowait/total) *100%irq in internal time period, hard interrupt time (%) (irq/total) *100%soft in internal time period, soft interrupt time (%) ( Softirq/total) *100%idle in internal time period, the CPU is removed from waiting for disk IO operation for any reason idle time idle time (%) (idle/total) *100
The calculation formula is as follows
Linux Command Summary mpstat command