简体   繁体   English

如何在Java中分析线程?

[英]How can I profile threads in Java?

I have producer and consumer threads in my application and I need to profile them to see the performance of the threads, time taken before each goes to sleep and waits, etc., and take corrective action to improve the over all efficiency of the application. 我的应用程序中有生产者和消费者线程,我需要对它们进行分析以查看线程的性能,每次进入休眠和等待之前所花费的时间等,并采取纠正措施来提高应用程序的整体效率。

Any suggestions on how to go about this? 关于如何解决这个问题的任何建议?

Personally I use YourKit java profiler. 我个人使用YourKit java profiler。 It has an excellent thread profiler tool that graphically shows the state of each thread at any given time, relative to one another (among other things). 它有一个出色的线程分析器工具,以图形方式显示每个线程在任何给定时间的状态,相对于彼此(以及其他)。 Worth a look 值得一看

http://www.yourkit.com/overview/index.jsp http://www.yourkit.com/overview/index.jsp

There are a number of tools, both free and non-free. 有许多工具,包括免费和非免费工具。
Check out javaperformancetuning.com for both tools and tricks. 查看javaperformancetuning.com的工具和技巧。
From personal experience I can say that VisualVM from snoracle is a good tool and NetBeans has a good profiler. 根据个人经验,我可以说snoracle的VisualVM是一个很好的工具,NetBeans有一个很好的分析器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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