您的位置:首页 > 其它

RH442攻略之mpstat

2014-03-14 17:54 766 查看
mpstat 是Multi ProcessorStatistics的缩写,与sar一样包含在sysstat包中,它报告CPU相关统计信息,这些信息存放在/proc/stat中。
该命令默认情况下显示AM、PM格式的时间,需要通过LANG=C来指定它使用24小时制时间;该命令支持delay和count两个参数,第一个参数是取值延时,单位秒,第二个参数是取值次数。以上特性与sar是一样的。
mpstat[-P {|ALL}] [internal [count]]
mpstat 1 5 #以1秒步进取5次数据,取值范围为CPU总计

[root@desktop7 ~]# mpstat 1 5
Linux 2.6.32-220.el6.x86_64 (desktop7.example.com)      03/14/14        _x86_64_        (4 CPU)
05:44:54     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
05:44:55     all    0.26    0.00   17.40    9.09    0.26    0.52    0.00    0.26   72.21
05:44:56     all    0.00    0.00   12.53   11.76    0.00    0.77    0.00    0.26   74.68
05:44:57     all    0.00    0.00    9.36   31.09    0.37    3.00    0.00    0.00   56.18
05:44:58     all    0.00    0.00   11.48   19.40    0.00    0.82    0.00    0.00   68.31
05:44:59     all    0.00    0.00    7.07   17.02    0.00    1.57    0.00    0.26   74.08
Average:     all    0.06    0.00   11.73   16.75    0.11    1.23    0.00    0.17   69.96
mpstat -P ALL 2 1 #以2秒步进取1次数据,取值范围为CPU总计及各个CPU核心(注意第2列的区别)
[root@desktop7 ~]# mpstat -P ALL 2 1
Linux 2.6.32-220.el6.x86_64 (desktop7.example.com)      03/14/14        _x86_64_        (4 CPU)
05:42:02     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
05:42:04     all    0.13    0.00    0.00    0.00    0.00    0.00    0.00    0.00   99.87
05:42:04       0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
05:42:04       1    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
05:42:04       2    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
05:42:04       3    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00

数据含义 %usr 用户级应用的CPU利用率(百分比),对应sar的%user
%nice 通过nice降级使用的用户级应用的CPU利用率(百分比),对应sar的%nice
%sys kernel级指令的CPU利用率(百分比),对应sar的%system
%iowait 等待未完成的磁盘I/O请求的CPU时间占比,对应sar的%iowait
%irq 处理硬中断时间
%soft 处理软中断时间
%steal 虚拟CPU的调度等待时间(被hypervisor偷走的cpu时间),对应sar的%steal
%guest 显示运行虚拟处理器时CPU花费时间的百分比
%idle CPU空闲百分比(并非等待磁盘I/O的空闲状态),对应sar的%idle
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  RH443 mpstat