The giant brother talks about how to find the java thread that occupies the highest CPU

The giant brother talks about how to find the java thread that occupies the highest CPU

How to find the j thread with the highest cpu usage in Java

1. Use the command top -p <pid> to display the memory status of your java process, pid is your java process number, such as 123
2, press H to get the memory status of each thread
3, find the highest memory and cpu occupancy The thread pid, such as 15248
4, execute printf 0x%x 15248 to get 0x3b90, which is the hexadecimal
5 of the thread id, execute jstack 123|grep -A 10 3b90, and get the thread stack information in the thread 3b90 behind the line 10 lines
6, look at the corresponding stack information to find out the code that may have problems

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324976992&siteId=291194637