Linux a thread that consumes high CPU in a process

Source: Internet
Author: User

1. Through top, find the process ID that consumes high CPU

2.

As shown in Java, the process ID is ' 52554′, and then the top command is used to monitor all threads in the process separately:

top-p52554 -H

3, (then see which Java thread CPU high, which thread memory used more)

4.

As shown in Linux, all Java internal threads actually correspond to a process ID, which means that the Sun JVM on Linux maps threads in Java programs for operating system processes, and we see that the process ID that consumes the most CPU resources is ' 15417′, This process ID corresponds to the ' Nid ' (' n ' stands for ' native ') in the Java thread information;

5, to find out exactly which part of the specific code occupies so many resources, first use Jstack to play the current stack information into a file, such as Stack.log:

    1. Jstack 52554 > stack. Log
    2. Python-c"print hex(9757)"然后记住二进制的号
    3. cat stack.log|grep 二进制的号

Linux a thread that consumes high CPU in a process

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.