简体   繁体   中英

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. 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.

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