mpstat - 处理器统计信息
1.不带任何参数的使用mpstat命令将会输出所有CPU的平均统计信息
- tecmint@tecmint ~ $ mpstat
- Linux 3.11.0-23-generic (tecmint.com) Thursday 04 September 2014 _i686_ (2 CPU)
- 12:23:57 IST CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
- 12:23:57 IST all 37.35 0.01 4.72 2.96 0.00 0.07 0.00 0.00 0.00 54.88
2.使用‘-p’ (处理器编号)和‘ALL’参数将会从0开始独立的输出每个CPU的统计信息,0表示第一个cpu。
- tecmint@tecmint ~ $ mpstat -P ALL
- Linux 3.11.0-23-generic (tecmint.com) Thursday 04 September 2014 _i686_ (2 CPU)
- 12:29:26 IST CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
- 12:29:26 IST all 37.33 0.01 4.57 2.58 0.00 0.07 0.00 0.00 0.00 55.44
- 12:29:26 IST 0 37.90 0.01 4.96 2.62 0.00 0.03 0.00 0.00 0.00 54.48
- 12:29:26 IST 1 36.75 0.01 4.19 2.54 0.00 0.11 0.00 0.00 0.00 56.40
3.要进行‘N’次,平均每次间隔n秒的输出CPU统计信息,如下所示。
- tecmint@tecmint ~ $ mpstat -P ALL 2 5
- Linux 3.11.0-23-generic (tecmint.com) Thursday 04 September 2014 _i686_ (2 CPU)
- 12:36:21 IST CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
- 12:36:23 IST all 53.38 0.00 2.26 0.00 0.00 0.00 0.00 0.00 0.00 44.36
- 12:36:23 IST 0 46.23 0.00 1.51 0.00 0.00 0.00 0.00 0.00 0.00 52.26
- 12:36:23 IST 1 60.80 0.00 3.02 0.00 0.00 0.00 0.00 0.00 0.00 36.18
- 12:36:23 IST CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
- 12:36:25 IST all 34.18 0.00 2.30 0.00 0.00 0.00 0.00 0.00 0.00 63.52
- 12:36:25 IST 0 31.63 0.00 1.53 0.00 0.00 0.00 0.00 0.00 0.00 66.84
- 12:36:25 IST 1 36.73 0.00 2.55 0.00 0.00 0.00 0.00 0.00 0.00 60.71
- 12:36:25 IST CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
- 12:36:27 IST all 33.42 0.00 5.06 0.25 0.00 0.25 0.00 0.00 0.00 61.01
- 12:36:27 IST 0 34.34 0.00 4.04 0.00 0.00 0.00 0.00 0.00 0.00 61.62
- 12:36:27 IST 1 32.82 0.00 6.15 0.51 0.00 0.00 0.00 0.00 0.00 60.51
(LCTT译注: 上面命令中‘2’ 表示每2秒执行一次‘mpstat -P ALL’命令, ‘5’表示共执行5次)