日期:2014-05-16  浏览次数:20618 次

linux系统查看系统性能命令详解(1)
一般我们查看系统性能主要是在以下几个方面
1.用户使用CPU情况 展现为 %user
2.系统使用CPU情况 展现为 %sys
3.wio或iowait     展现为 %iowait 进程由于等待磁盘IO而使CPU处于空闲状态的比率
4.CPU的空闲率
5.CPU上下文的交换的比率,也有说明为CPU上下文的切换。即内存和寄存器中数据的切换
6.nice 这个还不是很明白是啥意思
7.real-time 还是未知
8.运行队列的长度
9.平均负载

二 常用命令
1.mpstat
2.top
3.vmstat
4.sar
5.iostat
6.uptime

三命令详解
1. mpstat -P ALL 5    //需要注意的P和ALL一定要大写

17时22分24秒  CPU   %user   %nice    %sys %iowait    %irq   %soft  %steal   %idle    intr/s
17时22分29秒  all    0.30    0.00    0.10    0.67    0.02    0.07    0.00   98.83    821.40
17时22分29秒    0    1.00    0.00    0.60    1.00    0.20    0.60    0.00   96.60    560.00
17时22分29秒    1    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.20      0.00
17时22分29秒    2    0.60    0.00    0.20    0.20    0.00    0.20    0.00   99.00    250.20
17时22分29秒    3    0.00    0.00    0.00    4.00    0.00    0.00    0.00   96.00     11.20
17时22分29秒    4    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.20      0.00
17时22分29秒    5    0.80    0.00    0.00    0.00    0.00    0.00    0.00   99.20      0.00
17时22分29秒    6    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00      0.00
17时22分29秒    7    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00      0.00

上面信息我们可以看出,有8个CPU。
%user :在internal时间段里,即为用户态的CPU时间,及登录用户所消耗的CPU时间比。
%sys  :在internal时间段里,负进程消耗的CPU时间,占所有CPU的百分比
%nice :优先进程占用时间
%iowait:在internal时间段里,所有未等待磁盘IO操作进程占CPU的百分比
%irq  : 这个还是未知
%soft : 在internal时间段里,软中断时间(%) ?softirq/?total*100
%idle : 在internal时间段里,CPU除去等待磁盘IO操作外的因为任何原因而空闲的时间闲置时间 (%)
intr/s: 在internal时间段里,每秒CPU接收的中断的次数