定位耗费Cpu的进程
top -c,就可以显示进程列表,然后输入大写 P,按照cpu使用率排序
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
16896 root 20 0 8623m 406m 11m S 0.7 2.6 403:34.29 /data0/jdk7/usr/java/jdk1.7.0_15/b
5549 root 20 0 10.5g 3.1g 15m S 0.3 20.1 24:14.22 java -Dserver.name=game_server_938
20249 mysql 20 0 14.8g 3.9g 5076 S 0.3 24.9 2792:06 /usr/local/mysql/bin/mysqld --base
28760 root 20 0 823m 15m 2360 S 0.3 0.1 309:16.82 barad_agent
1 root 20 0 19348 964 736 S 0.0 0.0 5:43.76 /sbin/init
2 root 20 0 0 0 0 S 0.0 0.0 0:02.69 [kthreadd]
定位进程中哪个线程CPU过高
top -Hp 16896 输入大写 P
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
16979 root 20 0 8623m 406m 11m S 0.3 2.6 235:52.60 java
16896 root 20 0 8623m 406m 11m S 0.0 2.6 0:00.00 java
16897 root 20 0 8623m 406m 11m S 0.0 2.6 0:00.80 java
16898 root 20 0 8623m 406m 11m S 0.0 2.6 0:12.00 java
16899 root 20 0 8623m 406m 11m S 0.0 2.6 0:11.79 java
16900 root 20 0 8623m 406m 11m S 0.0 2.6 0:12.20 java
16901 root 20 0 8623m 406m 11m S 0.0 2.6 0:11.96 java
16902 root 20 0 8623m 406m 11m S 0.0 2.6 0:12.08 java
16903 root 20 0 8623m 406m 11m S 0.0 2.6 0:11.92 java
16904 root 20 0 8623m 406m 11m S 0.0 2.6 0:12.15 java
16905 root 20 0 8623m 406m 11m S 0.0 2.6 0:12.20 java
16906 root 20 0 8623m 406m 11m S 0.0 2.6 4:44.86 java
16907 root 20 0 8623m 406m 11m S 0.0 2.6 0:00.50 java
16979 转 16 进制 4253
[[email protected] ~]# jstack 16896 | grep '0x4253'
"QuartzScheduler_QuartzSchedulerThread" prio=10 tid=0x00007f94d4df4800 nid=0x4253 sleeping[0x00007f953befd000]