How to use Jstack to pinpoint the exception code (Java program CPU utilization is high)
Please jstack artifact to help
This paper introduces the secret of using Jstack location problem in Linux environment.
S1. "Top command" to find a process with high CPU utilization, get [process number], where PID is 12891
12891
S2. "PS P 12891-l-o pcpu,pid,tid,time,tname,cmd command" found in the above process, CPU utilization is higher than the [thread number TID] (decimal number), here is 12946
PS P 12891-l-o pcpu,pid,tid,time,tname,cmd
12946
S3. "printf"%x\n "12946 command" converts the acquired thread number (decimal number) to [hex], where 0x3292
printf "%x\n" 12946
3292
S4. "Jstack-l 12946" view the thread information for the process PID is 3036, nid is 0x3292
Jstack-l 12891 >/home/temp1 & VI/HOME/TEMP1 Search to 0x3292, see Code location
Jstack command locates the code location where the Java program has high CPU utilization