天天看点

In a system with multiple processors how can I display the utilization of each CPU individually ?

https://access.redhat.com/solutions/1178

In a system with multiple processors how can I display the utilization of each CPU individually ?

 SOLUTION 已验证 - 已更新 2013年九月12日06:39 - 

English 

环境

  • Red Hat Enterprise Linux 3
  • Red Hat Enterprise Linux 4
  • Red Hat Enterprise Linux 5
  • mpstat
  • sar

问题

  • In a system with multiple processors how can I display the utilization of each CPU individually ?

决议

  • Use "mpstat" or "sar" commands to reports processors related statistics.
  • CPU statistics of a single processor.

Raw

# mpstat -P <processor_number>
           

Eg:

# mpstat -P 0
Linux 2.6.32-358.14.1.el6.x86_64 (server1)  09/12/2013  _x86_64_    (4 CPU)

03:27:55 AM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
03:27:55 AM    0    9.30    0.17    3.14    1.57    0.00    0.01    0.00    0.00   85.80
           
  • CPU statistics of all processors.
# mpstat -P ALL
# sar -P ALL 
           
# mpstat -P ALL
Linux 2.6.32-358.14.1.el6.x86_64 (server1)  09/12/2013  _x86_64_    (4 CPU)

03:20:44 AM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
03:20:44 AM  all    4.73    0.12    1.78    0.62    0.00    0.01    0.00    0.00   92.74
03:20:44 AM    0    9.11    0.18    3.13    1.58    0.00    0.01    0.00    0.00   86.00
03:20:44 AM    1    6.77    0.29    2.73    0.59    0.00    0.03    0.00    0.00   89.59
03:20:44 AM    2    1.68    0.00    0.81    0.13    0.00    0.00    0.00    0.00   97.38
03:20:44 AM    3    1.40    0.00    0.47    0.18    0.00    0.00    0.00    0.00   97.93

# sar -P ALL 
Linux 2.6.32-358.14.1.el6.x86_64 (server1)  09/12/2013  _x86_64_    (4 CPU)

12:00:01 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
12:10:01 AM     all      8.71      0.00      2.77      0.89      0.00     87.62
12:10:01 AM       0     19.61      0.00      4.79      1.89      0.00     73.72
12:10:01 AM       1     13.04      0.00      5.29      1.20      0.00     80.46
12:10:01 AM       2      1.22      0.00      0.72      0.21      0.00     97.84
12:10:01 AM       3      1.10      0.00      0.31      0.29      0.00     98.30
12:20:01 AM     all      1.50      0.45      1.28      0.27      0.00     96.51           

继续阅读