简介
mpstat是Multiprocessor Statistics的缩写,是实时系统监控工具。其报告与CPU的一些统计信息,这些信息存放在/proc/stat文件中。在多CPUs系统里,其不但能查看所有CPU的平均状况信息,而且能够查看特定CPU的信息。mpstat最大的特点是:可以查看多核心cpu中每个计算核心的统计数据;而类似工具vmstat只能查看系统整体cpu情况
语法
mpstat [-P {|ALL}] [internal [count]]
参数 解释
-P {|ALL} 表示监控哪个CPU, cpu在[0,cpu个数-1]中取值
internal 相邻的两次采样的间隔时间、
count 采样的次数,count只能和delay一起使用
当没有参数时,mpstat则显示系统启动以后所有信息的平均值。有interval时,第一行的信息自系统启动以来的平均信息。从第二行开始,输出为前一个interval时间段的平均信息。
实例
01:48:12 PM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %idle
01:48:13 PM all 7.33 0.25 3.33 2.58 0.00 1.17 0.00 0.00 85.33
01:48:13 PM 0 9.90 0.00 6.93 11.88 0.00 2.97 0.00 0.00 68.32
01:48:13 PM 1 7.07 1.01 5.05 1.01 0.00 0.00 0.00 0.00 85.86
01:48:13 PM 2 4.04 0.00 4.04 0.00 0.00 1.01 0.00 0.00 90.91
01:48:13 PM 3 2.00 0.00 2.00 0.00 0.00 1.00 0.00 0.00 95.00
01:48:13 PM 4 5.00 0.00 3.00 0.00 0.00 1.00 0.00 0.00 91.00
01:48:13 PM 5 2.02 0.00 1.01 0.00 0.00 0.00 0.00 0.00 96.97
01:48:13 PM 6 12.87 0.00 6.93 14.85 0.00 2.97 0.00 0.00 62.38
01:48:13 PM 7 10.10 0.00 5.05 2.02 0.00 1.01 0.00 0.00 81.82
01:48:13 PM 8 9.09 0.00 2.02 1.01 0.00 1.01 0.00 0.00 86.87
01:48:13 PM 9 15.15 0.00 1.01 0.00 0.00 1.01 0.00 0.00 82.83
01:48:13 PM 10 2.02 0.00 1.01 0.00 0.00 1.01 0.00 0.00 95.96
01:48:13 PM 11 7.92 0.99 1.98 0.00 0.00 0.99 0.00 0.00 88.12
字段的含义如下
%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