Skip to main content

Tools for Analyzing Multithreaded Java Programs

2 replies [Last post]
Joined: 2010-01-08

Hi -- I'm looking to see if any tools exist that will let me analyze my multi-threaded Java program: Specifically I want a tool that'll show me exactly when each of my threads starts and stops running. (I have more threads than CPUs) I would like to see timings down to the microsecond. jvisualvm has a thread monitor tool but the timing resolution doesn't appear to be very good: My threads start and stop without the tool even realizing it.

Any pointers/suggestions would be greatly appreciated.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2010-01-20

Try tools bundled with the Java SDK itself like: jconsole, jstack, jstat, jhat ...etc.

they are all under the directory $JAVA_HOME/bin

Joined: 2008-05-05

hprof will show you the order of thread starts and stops but not times.

You could add tracing code to your run method to record start/stop times but the other thought is that thread starts are expensive. If you have that many threads starting and stopping that fast, then you might want to use a thread pool instead