Linux系统性能分析命令四:mpstat
来源:互联网 发布:大学生网络借贷的案例 编辑:程序博客网 时间:2024/06/05 09:07
简介
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时间段的平均信息。
如果没有第二个数字参数,mpstat将每隔两秒执行一次,直到按CTRL+C退出
实例
查看多核CPU核心的当前运行状况信息, 每2秒更新一次
mpstat 2
19:45:12 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %idle19:45:14 all 0.04 0.00 0.00 0.00 0.00 0.00 0.00 0.00 99.9619:45:16 all 0.00 0.00 0.00 0.03 0.00 0.00 0.00 0.00 99.9719:45:18 all 0.00 0.07 0.07 0.00 0.00 0.00 0.00 0.00 99.87
如果要看每个cpu核心的详细当前运行状况信息,输出如下:
mpstat -P ALL 219:43:58 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %idle19:43:59 all 0.00 0.00 0.04 0.00 0.00 0.00 0.00 0.00 99.9619:43:59 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.0019:43:59 1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00.......19:43:59 13 0.99 0.00 0.00 0.00 0.00 0.00 0.00 0.00 99.0119:43:59 14 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.0019:43:59 15 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
字段的含义如下
%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
计算公式如下
total_cur=user+system+nice+idle+iowait+irq+softirqtotal_pre=pre_user+ pre_system+ pre_nice+ pre_idle+ pre_iowait+ pre_irq+ pre_softirquser=user_cur – user_pretotal=total_cur-total_pre其中_cur 表示当前值,_pre表示interval时间前的值。上表中的所有值可取到两位小数点。
转直:
http://www.cnblogs.com/ggjucheng/archive/2013/01/13/2858775.html
http://www.cnblogs.com/stephen-liu74/archive/2011/12/05/2257887.html
0 0
- Linux系统性能分析命令四:mpstat
- Linux性能测试 mpstat命令
- Linux性能测试 mpstat命令
- Linux性能测试 mpstat命令
- linux系统监控 mpstat命令
- [转载]Linux性能测试 mpstat命令
- Linux性能分析工具——mpstat
- Linux性能测试 mpstat
- Linux系统性能分析命令
- Linux - mpstat 命令详解
- Linux命令之mpstat
- linux命令---mpstat
- linux 性能监控命令6——mpstat,vmstat,iostat
- Linux高性能服务器诊断工具(01) mpstat命令
- Linux命令---mpstat命令详解
- Linux 命令-mpstat -P ALL
- linux学习笔记--mpstat命令
- Linux--系统性能分析命令备忘
- android:cacheColorHint=“#00000000”
- IntelliJ IDEA 删除项目
- spring4的配置文件模板
- oracle获取当年第一天和最后一天的sql
- Latex error: Unknown graphics extension: eps
- Linux系统性能分析命令四:mpstat
- structs2GET请求参数中文乱码解决方法
- 写一个gson遇到的坑
- SAP物料主数据相关表、结构
- 单词的理解 —— 英译英
- 抽牌概率
- 《专题:C++语法基础》篇五:循环程序设计
- 2016年末个人小结
- @Resource和@Autowire的区别