Execute the following command with the root user, using PID 5423 for example:
1, according to the top command, to find high CPU-intensive processes, to find the PID
PID USER PR NI VIRT RES SHR S%cpu%MEM time+ COMMAND
5423 Root 0 8892 1284 856 R 0 0.0 0:00.04 Top
2, after the process is found, execute the following command to get the list of threads and sort by the thread that is consuming high CPU:
[Email protected]]# ps-mp 5423-o Thread,tid,time | Sort-rn
The results are shown as follows (example):
User%cpu PRI SCNT wchan user SYSTEM TID time
Root 10.5 19----3626 00:12:48
Root 10.1 19----3593 00:12:16
Found the most time-consuming thread 3626, taking up CPU time for 12 minutes!
3, convert the required thread ID to 16 binary format:
[[email protected] logs]# printf "%x\n" 3626
E18
4, the last print thread's stack information:
[[email protected]]# sudo-u start username jstack 5423 > Stack.log
Find out the CPU consumption of each thread in the process