AIX系统CPU性能评估

4、tprof

  使用tprof命令用于统计每个进程的CPU使用情况

  # tprof -x sleep 30

  该命令的输出结果可查看 __prof.all文件。

  此命令运行30秒钟,在当前目录下创建一个名为_prof.all 的文件。30秒钟内, CPU被调度次数约为3000次。__prof.all 文件中的字段Total 为此进程调度到的CPU次数。如果进程所对应的 Total字 段的值为1500,即表示该进程在3000次 CPU调度中占用了1500次,或理解为使用了一半的CPU时间。tprof的输出准确地显示出哪个进程在使用CPU 时间。

  在我下面的这一份示例中,可以看到,大部分的cpu时间都是被wait所占用的。这里的wait实际上是idle进程,可以表明这个系统是一个完全空闲的系统。

$ more __prof.all
        Process      PID      TID  Total Kernel   User Shared  Other
        =======      ===      ===  ===== ======   ==== ======  =====
           wait    40970    40971   2998   2998      0      0      0
           wait    32776    32777   2994   2994      0      0      0
           wait    24582    24583   2985   2985      0      0      0
           wait    16388    16389   2980   2980      0      0      0
          syncd   221254   155707     31     31      0      0      0
        caiUxOs   524540  2294015      3      0      0      3      0
           netm    73746    73747      1      1      0      0      0
       hats_nim  1671242  1220665      1      0      0      1      0
        snmpd64   598258  1245291      1      1      0      0      0
      rpc.lockd   639212  1728679      1      1      0      0      0
          tprof   704622  2277437      1      0      0      1      0
       trclogio   360524  2408625      1      1      0      0      0
          trace  1523820  2523145      1      0      0      1      0
         clinfo  1958102  2760945      1      1      0      0      0
             sh  1572938  2285709      1      1      0      0      0
        =======      ===      ===  ===== ======   ==== ======  =====
          Total                    12000  11994      0      6      0


          Process   FREQ  Total Kernel   User Shared  Other
          =======    ===  ===== ======   ==== ======  =====
             wait      4  11957  11957      0      0      0
            syncd      1     31     31      0      0      0
          caiUxOs      1      3      0      0      3      0
             netm      1      1      1      0      0      0
         hats_nim      1      1      0      0      1      0
          snmpd64      1      1      1      0      0      0
        rpc.lockd      1      1      1      0      0      0
            tprof      1      1      0      0      1      0
         trclogio      1      1      1      0      0      0
            trace      1      1      0      0      1      0
           clinfo      1      1      1      0      0      0
               sh      1      1      1      0      0      0
          =======    ===  ===== ======   ==== ======  =====
            Total     15  12000  11994      0      6      0

  在这里,对wait进程作一点补充说明。

  在AIX 5L下,你用ps aux会发现有一些root的wait进程

在AIX 5L下,你用ps aux会发现有一些root的wait进程
#ps aux |head -20
USER        PID %CPU %MEM   SZ  RSS    TTY STAT    STIME  TIME COMMAND
oracle   266354  5.7  0.0 50136 27524      - A    15:40:35  0:32 oracleora92 (LOC
root      17214  3.1  0.0   40   40      - A      Jul 04 24793:53 wait
root      16946  3.1  0.0   40   40      - A      Jul 04 24633:59 wait
root      16678  3.1  0.0   40   40      - A      Jul 04 24600:21 wait
root      53274  3.1  0.0   40   40      - A      Jul 04 24397:54 wait
root        286  3.1  0.0   40   40      - A      Jul 04 24371:55 wait
root       8196  3.0  0.0   40   40      - A      Jul 04 24312:40 wait
root        822  3.0  0.0   40   40      - A      Jul 04 24303:36 wait
root        554  3.0  0.0   40   40      - A      Jul 04 24261:50 wait
root      20776  2.7  0.0   40   40      - A      Jul 04 21502:46 wait
root      57372  2.7  0.0   40   40      - A      Jul 04 21439:31 wait
root      49176  2.7  0.0   40   40      - A      Jul 04 21423:47 wait
root      21044  2.7  0.0   40   40      - A      Jul 04 21398:24 wait
root      12848  2.7  0.0   40   40      - A      Jul 04 21357:07 wait
root      21312  2.7  0.0   40   40      - A      Jul 04 21324:26 wait
root      12580  2.7  0.0   40   40      - A      Jul 04 21293:06 wait
root      13116  2.7  0.0   40   40      - A      Jul 04 21195:47 wait
oracle   344612  0.3  0.0 57588 34976      - A      Jul 04 2663:08 ora_j000_ora92
oracle   430408  0.3  0.0 55908 33296      - A      Jul 04 2220:57 ora_j001_ora92

  wait就是CPU空闲的时候运行的空闲进程,AIX4上叫kproc。所以这个进程占用越大,表示机器越空闲。Wait进程的数量是由机器上的逻辑CPU的个数决定的,有几个逻辑CPU,就有几个wait进程

猜你喜欢

转载自tianyihuyidao9.iteye.com/blog/1491451