当前位置: 技术问答>linux和unix
如何使用top查看程序的内存占用情况?
来源: 互联网 发布时间:2016-12-01
本文导语: RT 19 0.00 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0% 20 0.01 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0% 21 0.00 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0% 22...
RT
19 0.00 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0%
20 0.01 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0%
21 0.00 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0%
22 0.01 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0%
23 0.00 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0%
32 0.00 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0%
33 0.02 0.2% 0.0% 0.0% 99.8% 0.0% 0.0% 0.0% 0.0%
34 0.87 92.0% 0.0% 2.0% 6.0% 0.0% 0.0% 0.0% 0.0%
35 0.02 2.2% 0.0% 0.0% 97.8% 0.0% 0.0% 0.0% 0.0%
36 0.00 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0%
37 0.03 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0%
38 0.03 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0%
39 0.02 0.2% 0.0% 0.0% 99.8% 0.0% 0.0% 0.0% 0.0%
--- ---- ----- ----- ----- ----- ----- ----- ----- -----
avg 0.04 3.8% 0.0% 0.2% 96.0% 0.0% 0.0% 0.0% 0.0%
System Page Size: 4Kbytes
Memory: 71911060K (17913792K) real, 75552736K (19746536K) virtual, 15590520K free Page# 1/43
CPU TTY PID USERNAME PRI NI SIZE RES STATE TIME %WCPU %CPU COMMAND
34 ? 17731 bill 234 20 309M 216M run 42:58 95.48 95.31 fileinstore
33 ? 132 root 152 20 62712K 55744K run 147:17 2.56 2.55 vxfsd
39 ? 18842 billtest 168 20 94296K 11656K sleep 45:43 1.91 1.91 GuardMain
19 ? 4192 bill 168 20 105M 23456K sleep 57:38 1.91 1.90 GuardMain
34 ? 136 root 152 20 4608K 4096K run 4:26 1.25 1.25 pagezerod
只能看到五个进程
使用top -s10 -d20|grep 我的程序pid
什么都不显示
hp-un
19 0.00 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0%
20 0.01 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0%
21 0.00 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0%
22 0.01 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0%
23 0.00 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0%
32 0.00 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0%
33 0.02 0.2% 0.0% 0.0% 99.8% 0.0% 0.0% 0.0% 0.0%
34 0.87 92.0% 0.0% 2.0% 6.0% 0.0% 0.0% 0.0% 0.0%
35 0.02 2.2% 0.0% 0.0% 97.8% 0.0% 0.0% 0.0% 0.0%
36 0.00 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0%
37 0.03 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0%
38 0.03 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0%
39 0.02 0.2% 0.0% 0.0% 99.8% 0.0% 0.0% 0.0% 0.0%
--- ---- ----- ----- ----- ----- ----- ----- ----- -----
avg 0.04 3.8% 0.0% 0.2% 96.0% 0.0% 0.0% 0.0% 0.0%
System Page Size: 4Kbytes
Memory: 71911060K (17913792K) real, 75552736K (19746536K) virtual, 15590520K free Page# 1/43
CPU TTY PID USERNAME PRI NI SIZE RES STATE TIME %WCPU %CPU COMMAND
34 ? 17731 bill 234 20 309M 216M run 42:58 95.48 95.31 fileinstore
33 ? 132 root 152 20 62712K 55744K run 147:17 2.56 2.55 vxfsd
39 ? 18842 billtest 168 20 94296K 11656K sleep 45:43 1.91 1.91 GuardMain
19 ? 4192 bill 168 20 105M 23456K sleep 57:38 1.91 1.90 GuardMain
34 ? 136 root 152 20 4608K 4096K run 4:26 1.25 1.25 pagezerod
只能看到五个进程
使用top -s10 -d20|grep 我的程序pid
什么都不显示
hp-un
|
貌似hp ux的top很不一样。
看了眼手册,用top -f输出到文件吧,可以-n指定多少行。
看了眼手册,用top -f输出到文件吧,可以-n指定多少行。