美文网首页
mpstat 使用指南

mpstat 使用指南

作者: 佛心看世界 | 来源:发表于2019-05-13 10:24 被阅读0次

    mpstat 是Multiprocessor Statistics的缩写,是实时系统监控工具。其报告与CPU的一些统计信息,这些信息存放在/proc/stat文件中。在多CPUs系统里,其不但能查看所有CPU的平均状况信息,而且能够查看特定CPU的信息。下面只介绍 mpstat与CPU相关的参数,mpstat的语法如下:

    说明

    mpstat [-P {|ALL}] [internal [count]]
    
    CPU 处理器ID  其中_cur 表示当前值,_pre表示interval时间前的值。上表中的所有值可取到两位小数点
    参数 解释 
    -P {|ALL} 表示监控哪个CPU, cpu在[0,cpu个数-1]中取值 
    internal 相邻的两次采样的间隔时间 
    count 采样的次数,count只能和delay一起使用 
    
    当没有参数时,mpstat则显示系统启动以后所有信息的平均值。有interval时,第一行的信息自系统启动以来的平均信息。从第二行开始,输出为前一个interval时间段的平均信息。 
    
    

    例子

    #mpstat -P ALL 2 10 
    Linux 2.6.18-53.el5PAE (localhost.localdomain)  03/28/2009 
     
    10:07:57 PM  CPU   %user   %nice    %sys %iowait    %irq   %soft  %steal   %idle    intr/s 
    10:07:59 PM  all   20.75    0.00   10.50    1.50    0.25    0.25    0.00   66.75   1294.50 
    10:07:59 PM    0   16.00    0.00    9.00    1.50    0.00    0.00    0.00   73.50   1000.50 
    10:07:59 PM    1   25.76    0.00   12.12    1.52    0.00    0.51    0.00   60.10    294.00
    
    
    user 在internal时间段里,用户态的CPU时间(%) ,不包含 nice值为负 进程 dusr/dtotal*100 
    nice 在internal时间段里,nice值为负进程的CPU时间(%) dnice/dtotal*100 
    system 在internal时间段里,核心时间(%) dsystem/dtotal*100 
    iowait 在internal时间段里,硬盘IO等待时间(%) diowait/dtotal*100 
    irq 在internal时间段里,软中断时间(%) dirq/dtotal*100 
    soft 在internal时间段里,软中断时间(%) dsoftirq/dtotal*100 
    idle 在internal时间段里,CPU除去等待磁盘IO操作外的因为任何原因而空闲的时间闲置时间 (%) didle/dtotal*100 
    intr/s 在internal时间段里,每秒CPU接收的中断的次数 dintr/dtotal*100 
    CPU总的工作时间=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 
    duser=user_cur – user_pre 
    dtotal=total_cur-total_pre 
    
    image.png

    相关文章

      网友评论

          本文标题:mpstat 使用指南

          本文链接:https://www.haomeiwen.com/subject/wzakaqtx.html