1. Locate the PID corresponding to the Java process. Through Task Manager. Linux---Top
2. Then export the Java process snapshot. Run the command directly. Stack-l 31372 > c:/31372.stack
3. Under Windows, you can only view the CPU utilization of the process, to see the CPU utilization of the thread with other tools, I use the Microsoft-provided process Explorer v15.3
Right-click the process you want to see---properties
Linux first enter top, and then press shift+h or "H", at this time the thread view is open, PID is the thread number
4. Then select the Threads tab to find the TID for the CPU-consuming thread, for example, I'm a 31876 thread here.
5. Convert the PID into 16, I am here directly with the system of the calculator conversion, placed on why to convert, because the previous information exported with Jstack in the thread corresponding to the TID is 16 binary.
CMD---calc---the upper left corner of the calculator select programmer, which can be converted into binary. Finally get the 16 binary value of the thread PID is 7c84
6. Find 7c84 in the 31372.stack file in C drive
Thread-23 "prio=6 tid=0x03072400 nid= 0x1b68runnable [0x0372f000]
Java.lang.Thread.State:RUNNABLE
At Com.horn.util.MyEncrypt.encode (Myencrypt.java:)
At Com.horn.common.OrderUtil.hisExp (Orderutil.java:228)
At COM.HORN.UTIL.MSGMANAGE.RECEIVEMSG (Msgmanage.java:961)
At Com.horn.util.PollMessageThread.run (Pollmessagethread.java:)
Locked ownable synchronizers:-None
Windows pull out Java programs that consume high CPU threads