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 and the CPU is valued in [0,cpu number-1]
Internal the interval of two adjacent samples,
Count number of samples, count can only be used with delay
When there are no parameters, 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 2
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 9 9.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 2
19: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.0 0 0.00 0.00) 0.00 100.00
....... 19:43:59 13 0.99 0.00 0.00 0.00 0.00 0.00 0.00 0.00 99.0119:43:59 14 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.0019:43:5 9 15 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 the internal time period, the 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, HDD 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 the disk IO operation for any reason idle time idle time (%) (idle/total) *100
The calculation formula is as follows
Total_cur=user+system+nice+idle+iowait+irq+softirq
total_pre=pre_user+ pre_system+ pre_nice+ pre_idle+ pre_iowait+ pre_irq+ PRE_SOFTIRQ
User=user_cur–user_pre
Total=total_cur-total_pre
Where _cur represents the current value, and _pre represents the value before interval time. All values in the table above are desirable to a two-bit decimal point.
Http://www.cnblogs.com/stephen-liu74/archive/2011/12/05/2257887.html
Linux CPU real-time monitoring Mpstat command detailed