1. 查看线程 cpu 占用
查看进程 id:ps,jps,top 什么的都可以看到
找到进程id后,用top进程内线程占用:
-
# top -H -p 54123
-
-
Tasks: 39 total, 3 running, 36 sleeping, 0 stopped, 0 zombie
-
%Cpu(s): 72.6 us, 8.7 sy, 0.0 ni, 15.2 id, 0.0 wa, 0.0 hi, 0.4 si, 3.2 st
-
KiB Mem : 16777216 total, 14912272 free, 18446744+used, 27381108 buff/cache
-
top - 09:39:00 up 14:45, 0 users, load average: 1.55, 1.39, 2.71
-
Threads: 137 total, 1 running, 136 sleeping, 0 stopped, 0 zombie
-
%Cpu(s): 13.4 us, 16.0 sy, 0.0 ni, 64.6 id, 0.0 wa, 0.0 hi, 0.4 si, 5.7 st
-
KiB Mem : 16777216 total, 8301784 free, 18446744+used, 33899612 buff/cache
-
top - 09:39:32 up 14:46, 0 users, load average: 1.40, 1.37, 2.66
-
Threads: 137 total, 1 running, 136 sleeping, 0 stopped, 0 zombie
-
%Cpu(s): 14.2 us, 15.5 sy, 0.0 ni, 62.3 id, 0.0 wa, 0.0 hi, 0.3 si, 7.7 st
-
KiB Mem : 16777216 total, 6597192 free, 18446744+used, 35602252 buff/cache
-
KiB Swap: 0 total, 0 free, 0 used. 37906940 avail Mem
-
-
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
-
54302 admin 20 0 12.5g 994464 13856 R 97.4 5.9 2:59.45 java -server -Xms1g -Xmx10g -Dproject.name=sus -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -XX:NativeMemoryTracking=detail -XX:+Use+
-
54133 admin 20 0 12.5g 994464 13856 S 1.3 5.9 0:00.30 java -server -Xms1g -Xmx10g -Dproject.name=sus -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -XX:NativeMemoryTracking=detail -XX:+Use+
-
54134 admin 20 0 12.5g 994464 13856 S 1.0 5.9 0:00.29 java -server -Xms1g -Xmx10g -Dproject.name=sus -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -XX:NativeMemoryTracking=detail -XX:+Use+
-
54135 admin 20 0 12.5g 994464 13856 S 1.0 5.9 0:00.33 java -server -Xms1g -Xmx10g
上面橙色背景的是 cpu 利用率,黄色背景的是进程号。
需要用 printf 把十进程进程号转为16进程:
#printf %x 54302
d41e
2. 查看线程堆栈
jstack 54123 | grep d41e -B 1 -A 50
阅读(286780) | 评论(0) | 转发(0) |