fedora 11 下分析系统性能瓶颈之(一)mpstat

CPU是我们时常关注的,linux下面提供了很多查看系统性能的工具,像mpstat,iostat,vmstat,top等。
下面分别分析一下:
mpstat是Multiprocessor Statistics的缩写,是实时系统监控工具。其报告与CPU的一些统计信息,这些信息存放在/proc/stat文件中。在多CPUs系统里,其不但能查看所有CPU的平均状况信息,而且能够查看特定CPU的信息。具体参数man一下便知。

[root@Tux algorithm]# mpstat -P ALL 5 2
Linux 2.6.30.5-43.fc11.i686.PAE (Tux) 2009年09月23日

19时44分56秒 CPU %user %nice %sys %iowait %irq %soft %steal %idle intr/s
19时45分01秒 all 4.59 0.00 0.98 1.07 0.10 0.00 0.00 93.26 889.60
19时45分01秒 0 2.59 0.00 1.20 2.20 0.20 0.00 0.00 93.81 71.80
19时45分01秒 1 6.49 0.00 0.95 0.00 0.00 0.00 0.00 92.56 1.60

19时45分01秒 CPU %user %nice %sys %iowait %irq %soft %steal %idle intr/s
19时45分06秒 all 4.59 0.00 1.08 0.88 0.00 0.20 0.00 93.26 929.80
19时45分06秒 0 5.20 0.00 1.20 1.80 0.00 0.60 0.00 91.20 75.40
19时45分06秒 1 4.20 0.00 0.95 0.00 0.00 0.00 0.00 94.85 0.40

Average: CPU %user %nice %sys %iowait %irq %soft %steal %idle intr/s
Average: all 4.59 0.00 1.03 0.98 0.05 0.10 0.00 93.26 909.70
Average: 0 3.90 0.00 1.20 2.00 0.10 0.30 0.00 92.51 73.60
Average: 1 5.34 0.00 0.95 0.00 0.00 0.00 0.00 93.70 1.00

让它显示所有CPU的信息,每5秒一次,共显示2次。

各参数信息:
       CPU
              Processor  number. The keyword all indicates that statistics are calculated as averages among all processors.
            处理器号,all表示显示所有CPU的平均信息。
       %user
              Show the percentage of CPU utilization that occurred while executing at the user level (application).
             显示用户态的CPU利用率。
       %nice
              Show the percentage of CPU utilization that occurred while executing at the user level with nice priority.
            显示用户态下程序中使用nice优先级程序的CPU占用率,我这里没有用,因此都是0。
       %sys
              Show the percentage of CPU utilization that occurred while executing at the system level (kernel). Note  that
              this does not include time spent servicing interrupts or softirqs.
            显示内核态的CPU利用率。注意这里的内核态时间不包括服务中断或软中断,因为我们知道即使是用户态程序的中断也是属于内核态的任务。
       %iowait
              Show  the  percentage  of time that the CPU or CPUs were idle during which the system had an outstanding disk
              I/O request.
             显示CPU在等待系统I/O时占用的时间百分比。
       %irq
              Show the percentage of time spent by the CPU or CPUs to service interrupts.
             服务的中断所占用的时间比。
      %soft
              Show the percentage of time spent by the CPU or CPUs to service softirqs.  A softirq (software interrupt)  is
              one of up to 32 enumerated software interrupts which can run on multiple CPUs at once.
            软中断用时百分比。
       %steal
              Show  the  percentage  of  time spent in involuntary wait by the virtual CPU or CPUs while the hypervisor was
              servicing another virtual processor.
           偶尔的虚拟CPU占用的时间比。我的机器上没有装虚拟机,所以肯定是为0.
       %idle
              Show the percentage of time that the CPU or CPUs were idle and the system did not have  an  outstanding  disk
              I/O request.
           CPU在不等待系统I/O的空闲时间占的百分比。
       intr/s
              Show the total number of interrupts received per second by the CPU or CPUs.
             每秒钟CPU接受到的中断数。这玩意有时候会挺多,那是在内部了,我们都感觉不到。
       Note: On SMP machines a processor that does not have any activity at all is a disabled (offline) processor.

你可能感兴趣的:(fedora)