一、mpstat命令1.1命令格式mpstat[-A][-u][-V][-I{SUM|中央处理器|中央处理器|所有}][-P{cpu[,...]|开|ALL}][interval[count]]OPTIONS:-A:等价于-u-IALL-PALL-I:可以指定四个参数:SUMCPUSCPUALL,SUM代表每个处理器的中断总数,CPU表示每核每秒的中断数,SCPU表示每核每秒的软中断数,2.6.31之后才支持。-P:统计CPU数量,一般使用ALL-u:输出列信息-V:查看工具版本号2.使用2.1每隔1s输出所有CPU的使用情况$mpstat-PALL1Linux3.10.0-693。el7.x86_64(zhanghao)February26,2019_x86_64_(2CPU)12:42:03CPU%usr%nice%sys%iowait%irq%soft%steal%guest%gnice%idle12:42:04ALL0.000.000.000.000.000.000.000.000.00100.0012:4204秒0.000.000.000.000.000.000.000.000.000.00100.0012,0.000.000.000.000.000.000.000.000.00100.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.0042分钟Guest%GNICE%Idle12:42minutes05secondsALL0.000.000.000.000.000.00100.00.0012minutes0.000.000.000.000.000.000.000.000.000.00100.0012:42:0510.000.000.000.000.000.000.000.000.00100.0012:42:05CPU%usr%nice%sys%iowait%irq%soft%窃取%guest%gnice%idle12:4206秒全0.000.000.000.500.000.000.000.000.0099.50120.000.000.000.000.000.000.000.000.000.00100.00.00.00.00.00.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.00100.00.00.00.00.00.00.0012分钟06秒06秒秒秒06秒秒秒。CPU%usr%sys%sys%irq%soft%ket%ket%guest%gnice%闲置1242全部0.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.00100.0012:42:42点07秒0.000.000.000.000.000.000.000.000.00100.0012:4207秒0.000.000.000.000.000.000.000.000.00100.0012分钟CPU%usr%usr%sys%IRQ%irq%soft%soft%ket%ketguestguestguestguestguestguest%gnice%gnicegnicegnicegnicegnicegnicegnice%idle%0.000.000.000.00100.0012:42:0800.000.000.000.000.000.000.000.000.00100.0012:42:0810.000.000.000.000.000.000.000.000.00100.00字段分析:CPU:各个CPU的进程id%usr:用户模式下的CPU利用率%nice:withnicepriorityunderuser,CPUusage%sys:显示在内核模式下执行内核时发生的CPU利用率百分比。这不包括维护硬件和软件中断所花费的时间。%iowait:显示当系统有未完成的磁盘I/O请求时CPU或CPU空闲的时间百分比%irq:系统处理硬中断所花费的时间百分比%soft:系统处理软中断所花费的时间百分比%steal:显示虚拟CPU或CPU被迫等待的时间百分比,而管理程序正在为另一个虚拟处理器提供服务%guest:CPU处理虚拟进程所花费的时间%idel:CPU空闲百分比2.2查看软中断统计信息$mpstat-ISCPPU1Linux3.10.0-693.el7.x86_64(zhanghao)February26,2019_x86_64_(2CPU)15:23:07CPUHI/sTIMER/sNET_TX/sNET_RX/sBLOCK/sBLOCK_IOPOLL/sTASKLET/sSCHED/shrtimer/srcu/s15:23:0800.005.000.000.000.000.000.000.000.000.000.004.0015:23:0810.000.050.000.000.000.000.000.0024.000.000.000.003.0015:23秒09秒09秒0.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.005.0009sectessssects0.0026.000.0070.000.0024.000.002.00150.0016.000.0016.000.000.000.000.000.0012.000.003.0015:23:10seconds10.0013.000.000.000.000.000.001.00151.001511seconds0.0018.000.000.000.0014.003.0015,11seconds,10.000.005.005.005.000.000.000.0010.000.001.0015:23:12seconds0.008.000.000.000.000.000.000.003.001512seconds12seconds10.0030.0040.000.000.000.004.00150.007.000.000.000.000.000.00.000.003.000.003.0015:23:1310.0023.000.007.000.000.000.0022.000.001.0015:23:14seconds0.0011.000.000.000.000.000.007.000.006.0015:23:10.0030.000.001.000.000.000.008.0015,15seconds0.000.000.000.006.006.0015,23minutesand15seconds10.0031.000.007.000.000.000.0024.000.005.0015:23:0.008.000.000.000.000.004.006.0015、23分钟,16秒10.000.000.000.000.000.000.000.003.0015、23分钟,0.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.006.006.006.006.000.000.000.003.003.0015:1710.0024.000.000.000.0024.000.000.007.000.000.000.0023.000.001.002.3每2s输出一次,输出3次$mpstat23Linux3.10.0-693.el7.x86_64(zhanghao)February27,2019_x86_64_(2CPU)02:13:29CPU%USR%Nice%SYS%IOWAIT%IRQ%Soft%STEAL%Guest%Gnice%IDLE02ALL0.000.000.000.000.000.000.00100.00233secondsALL0.000.000.000.000.000.000.000.000.000.000.00100.0002:13:35all0.000.000.000.000.000.000.000.000.00100.00平均时间:全部0.000.000.000.000.000.000.000.000.0010
