Linux:mpstat command

HLee 2022-06-24 05:30:04 阅读数:979

linuxmpstatcommand

mpstat Show each available CPU The state of , Mainly used for more CPU In the environment , It shows each available CPU The state of is that you want to . This information is stored /proc/stat In file . In a multiple CPUs In the system , It can not only see all CPU The average status of , And be able to view specific CPU Information about .

mpstat ( Options ) ( Parameters )
Options :-P: Appoint CPU Number
Parameters :
Time interval between : The interval between each report ( second )
frequency : Show number of reports 

example : When mpstat Without parameters , The output is the average since the system was started

[[email protected] ~]$ mpstat
Linux 2.6.32-504.el6.x86_64 (idc1) 08/10/2021 _x86_64_ (8 CPU)
05:38:49 PM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %idle
05:38:49 PM all 4.27 0.00 0.44 0.00 0.00 0.03 0.12 0.00 95.14

example : Show ID by 1 Of CPU Information :mpstat -P 1 1( The interval is 1s)

[[email protected] ~]$ mpstat -P 1 1
Linux 2.6.32-504.el6.x86_64 (idc1) 08/10/2021 _x86_64_ (8 CPU)
05:54:17 PM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %idle
05:54:18 PM 1 0.99 0.00 0.00 0.00 0.00 0.00 0.99 0.00 98.02
05:54:19 PM 1 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 99.00
05:54:20 PM 1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
05:54:21 PM 1 1.98 0.00 0.99 0.00 0.00 0.00 0.00 0.00 97.03

example : Show all CPU Information :mpstat -P ALL 2 3 ( The interval is 2s,3 Time )

[[email protected] ~]$ mpstat -P ALL 2 3
Linux 2.6.32-504.el6.x86_64 (idc1) 08/10/2021 _x86_64_ (8 CPU)
05:50:38 PM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %idle
05:50:40 PM all 1.13 0.00 0.88 0.00 0.00 0.06 0.13 0.00 97.81
05:50:40 PM 0 0.50 0.00 0.50 0.00 0.00 0.00 0.00 0.00 98.99
05:50:40 PM 1 1.00 0.00 0.50 0.00 0.00 0.00 0.50 0.00 98.00
05:50:40 PM 2 0.99 0.00 0.99 0.00 0.00 0.00 0.50 0.00 97.52
05:50:40 PM 3 0.00 0.00 0.50 0.00 0.00 0.00 0.00 0.00 99.50
05:50:40 PM 4 3.00 0.00 2.00 0.00 0.00 0.50 0.50 0.00 94.00
05:50:40 PM 5 1.00 0.00 1.00 0.00 0.00 0.00 0.50 0.00 97.51
05:50:40 PM 6 1.00 0.00 1.50 0.00 0.00 0.00 0.00 0.00 97.50
05:50:40 PM 7 1.50 0.00 0.50 0.00 0.00 0.00 0.00 0.00 98.00
05:50:40 PM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %idle
05:50:42 PM all 0.94 0.00 0.63 0.00 0.00 0.00 0.19 0.00 98.25
05:50:42 PM 0 0.50 0.00 0.50 0.00 0.00 0.00 0.00 0.00 98.99
05:50:42 PM 1 1.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 98.00
05:50:42 PM 2 0.50 0.00 0.50 0.00 0.00 0.00 0.00 0.00 98.99
05:50:42 PM 3 0.50 0.00 0.00 0.00 0.00 0.00 0.50 0.00 98.99

Field description :

user: stay internal In the time period , User state CPU Time (%), It doesn't contain nice Value is negative process , The value is (usr/total)*100;
nice: stay internal In the time period ,nice Value is negative process CPU Time (%), The value is (nice/total)*100;
system: stay internal In the time period , Core time (%), The value is (system/total)*100;
iowait: stay internal In the time period , Hard disk IO Waiting time (%), The value is (iowait/total)*100;
irq: stay internal In the time period , Hard interrupt time (%), The value is (irq/total)*100;
soft: stay internal In the time period , Soft interrupt time (%), The value is (softirq/total)*100;
idle: stay internal In the time period ,CPU Remove the waiting disk IO Idle time out of operation for any reason (%), The value is (idle/total)*100;
intr/s: stay internal In the time period , Per second CPU The number of interrupts received , The value is (intr/total)*100;
copyright:author[HLee],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/175/20210810191540508A.html