⑥linux mpstat

mpstat 每两秒更新一次 更新5次

[root@racknerd-8c3b2d ~]# mpstat 2 5
Linux 3.10.0-1160.11.1.el7.x86_64 (racknerd-8c3b2d) 	03/11/2021 	_x86_64_	(2 CPU)

08:32:49 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
08:32:51 PM  all    0.25    0.00    0.00    0.00    0.00    0.00    0.25    0.00    0.00   99.50
08:32:53 PM  all    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
08:32:55 PM  all    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
08:32:57 PM  all    0.00    0.00    0.25    0.00    0.00    0.00    0.00    0.00    0.00   99.75
08:32:59 PM  all    0.25    0.00    0.25    0.00    0.00    0.25    0.50    0.00    0.00   98.75
Average:     all    0.10    0.00    0.10    0.00    0.00    0.05    0.15    0.00    0.00   99.60

mpstat -P 0 5 0号cpu五秒更新一次

[root@racknerd-8c3b2d ~]# mpstat -P 0 2
Linux 3.10.0-1160.11.1.el7.x86_64 (racknerd-8c3b2d) 	03/11/2021 	_x86_64_	(2 CPU)

08:34:34 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
08:34:36 PM    0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
08:34:38 PM    0    0.00    0.00    0.50    0.00    0.00    0.00    0.00    0.00    0.00   99.50

字段的含义

%user      在internal时间段里,用户态的CPU时间(%),不包含nice值为负进程  (usr/total)*100
%nice      在internal时间段里,nice值为负进程的CPU时间(%)   (nice/total)*100
%sys       在internal时间段里,内核时间(%)       (system/total)*100
%iowait    在internal时间段里,硬盘IO等待时间(%) (iowait/total)*100
%irq         在internal时间段里,硬中断时间(%)     (irq/total)*100
%soft       在internal时间段里,软中断时间(%)     (softirq/total)*100
%idle       在internal时间段里,CPU除去等待磁盘IO操作外的因为任何原因而空闲的时间闲置时间(%) (idle/total)*100
原文地址:https://www.cnblogs.com/yangtao416/p/14521997.html