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 app开发者_如何学Pythonlication.
Any suggestions on how to go about this?
Personally I use 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
There are a number of tools, both free and non-free.
Check out javaperformancetuning.com for both tools and tricks.
From personal experience I can say that VisualVM from snoracle is a good tool and NetBeans has a good profiler.
精彩评论