Jstack command locates the code location where the Java program has high CPU utilization

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.