简体   繁体   中英

How do I find top 10 or top few CPU intensive threads created by Java process in Linux?

How do I find top 10 or top few CPU intensive thread stack traces created by Java process in Linux ? I would like to know how much time spent as well if possible

This is simple and easy. And it worked! We need more tools like this in Java.

https://github.com/patric-r/jvmtop

You get the below information by using one command jvmptop.sh <pid>

在此处输入图片说明

Standard linux tool like top will just give top processes, which are consuming the most cpu. but will not be able to tell that what all the threads inside a single java process is taking most of the cpu.

You need a profiling tool like YourKit to determine what threads in java process is using most of the cpu and you can enable trace based sampling in yourkit to even get the invocation count of a method as well.

please refer https://www.yourkit.com/docs/java/help/cpu_intro.jsp doc , on how to get started with CPU profiling using yourkit.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM