在Linux下使用top命令查看所有java进程的状态_JAVA_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > JAVA > 在Linux下使用top命令查看所有java进程的状态

在Linux下使用top命令查看所有java进程的状态

 2011/10/31 8:29:24  codingstandards  http://codingstandards.iteye.com  我要评论(0)
  • 摘要:在Linux下使用top命令查看所有java进程的状态Bash脚本文件jtop.sh#!/bin/bash#PIDS=$(ps-e|grepjava|awk'{print$1}'|sed's/^/-p/')#top$PIDStop$(ps-e|grepjava|awk'{print$1}'|sed's/^/-p/')#END.使用实例[root@webjava]#./jtop.shtop-10:40:23up452days,14:10,6users,loadaverage:1.38,0.91
  • 标签:Linux 使用 Java 命令

在Linux下使用top命令查看所有java进程的状态

Bash脚本文件 jtop.sh

#!/bin/bash

#PIDS=$(ps -e | grep java | awk '{print $1}' | sed 's/^/-p/')
#top $PIDS

top $(ps -e | grep java | awk '{print $1}' | sed 's/^/-p/')

#END.

?

使用实例

[root@web java]# ./jtop.sh

top - 10:40:23 up 452 days, 14:10,? 6 users,? load average: 1.38, 0.91, 0.91
Tasks:?? 8 total,?? 0 running,?? 8 sleeping,?? 0 stopped,?? 0 zombie
Cpu(s):? 7.5%us,? 0.2%sy,? 0.0%ni, 92.0%id,? 0.0%wa,? 0.2%hi,? 0.2%si,? 0.0%st
Mem:?? 4075420k total,? 2164652k used,? 1910768k free,?? 139740k buffers
Swap:? 5406712k total,?? 265748k used,? 5140964k free,?? 627268k cached

? PID USER????? PR? NI? VIRT? RES? SHR S %CPU %MEM??? TIME+? COMMAND???????????????????????????????????????????????????????????????
20914 root????? 25?? 0 1446m 413m? 11m S 13.0 10.4?? 0:35.91 java??????????????????????????????????????????????????????????????????
?4797 root????? 20?? 0 1293m 120m 7952 S? 2.7? 3.0 908:25.78 java??????????????????????????????????????????????????????????????????
?4780 root????? 20?? 0 1153m 274m 6952 S? 0.0? 6.9 233:29.03 java??????????????????????????????????????????????????????????????????
10842 root????? 21?? 0 1202m 126m 7300 S? 0.0? 3.2 649:38.71 java??????????????????????????????????????????????????????????????????
24065 root????? 25?? 0 1200m 138m 7576 S? 0.0? 3.5 139:00.00 java??????????????????????????????????????????????????????????????????
25507 root????? 19?? 0 1144m? 24m 6960 S? 0.0? 0.6 256:47.51 java??????????????????????????????????????????????????????????????????
25521 root????? 25?? 0 1182m? 41m 7528 S? 0.0? 1.0 283:52.79 java??????????????????????????????????????????????????????????????????
28505 root????? 20?? 0 1140m? 24m 7240 S? 0.0? 0.6 276:55.52 java??

?

?

发表评论
用户名: 匿名