tprof 命令
?
自动离线方式
<!--[if !supportLists]-->32.??????<!--[endif]-->tprof -c -A all -xsleep 10
<!--[if !supportLists]-->33.??????<!--[endif]-->启动命令 sleep 10
<!--[if !supportLists]-->34.??????<!--[endif]-->停止跟踪收集。
<!--[if !supportLists]-->35.??????<!--[endif]-->2002 年 3 月 20 日,星期一00:52:52
<!--[if !supportLists]-->36.??????<!--[endif]-->系统:AIX 5.2 节点:dreaming 机器
?
?
====================================================================
tprof -x sleep 5
?
?
?
Process ? ? ? ? ? ? ? ? ? PID ? ? ?TID ?Total Kernel ? User Shared ?Other
======= ? ? ? ? ? ? ? ? ? === ? ? ?=== ?===== ====== ? ==== ====== ?=====
wait ? ? ? ? ? ? ? ? ? ? 8196 ? ? 8197 ?40.36 ?40.36 ? 0.00 ? 0.00 ? 0.00
wait ? ? ? ? ? ? ? ? ? ?53274 ? ?61471 ?38.46 ?38.46 ? 0.00 ? 0.00 ? 0.00
wait ? ? ? ? ? ? ? ? ? ?49176 ? ?57373 ? 4.62 ? 4.62 ? 0.00 ? 0.00 ? 0.00
wait ? ? ? ? ? ? ? ? ? ?57372 ? ?69667 ? 4.52 ? 4.52 ? 0.00 ? 0.00 ? 0.00
./xxxxx ? ? ? ? ? ? ? ?209070 ? 876621 ? 2.62 ? 1.45 ? 0.63 ? 0.54 ? 0.00
./xxxxx?? ? ? ? ? ? ? ?209070 ?1306857 ? 2.35 ? 0.45 ? 1.09 ? 0.81 ? 0.00
./xxxxx?? ? ? ? ? ? ? ?209070 ?1011735 ? 1.90 ? 0.36 ? 1.09 ? 0.45 ? 0.00
./xxxxx?? ? ? ? ? ? ? ?209070 ?1130543 ? 1.90 ? 0.54 ? 0.90 ? 0.45 ? 0.00
./xxxxx?? ? ? ? ? ? ? ?209070 ?1261733 ? 1.54 ? 0.18 ? 1.09 ? 0.27 ? 0.00
./xxxxx?? ? ? ? ? ? ? ?209070 ?1396843 ? 0.72 ? 0.54 ? 0.00 ? 0.18 ? 0.00
dtgreet ? ? ? ? ? ? ? ?110674 ? 254095 ? 0.72 ? 0.45 ? 0.00 ? 0.27 ? 0.00
/usr/bin/tprof ? ? ? ? 409664 ? 872671 ? 0.09 ? 0.09 ? 0.00 ? 0.00 ? 0.00
PID-1 ? ? ? ? ? ? ? ? ? ? ?-1 ? 893131 ? 0.09 ? 0.00 ? 0.00 ? 0.09 ? 0.00
/usr/bin/trcstop ? ? ? 430324 ? 901143 ? 0.09 ? 0.00 ? 0.00 ? 0.09 ? 0.00
======= ? ? ? ? ? ? ? ? ? === ? ? ?=== ?===== ====== ? ==== ====== ?=====
Total ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?100.00 ?92.04 ? 4.80 ? 3.17 ? 0.00
?
命令执行之后,会产生一个sleep.prof的文件,上面就是截取的一段内容,可以根据./xxxx后面几列
的内容计算出5秒之内xxxxx进程占用的cpu时间,从而计算出比较精确的xxxx的即时的cpu占用率,
这里要说明的是ps -aux 出来的那个cpu占用率不是即时的。我只找出了这个方法使用程序来得到进程
的cpu占用率的即时值。topas的输出结果,java逮不到。