Monitoring thread stalls

T

Tom Davies

I have a multithreaded application which fails to fully utilize all the
CPUs on a multiprocessor box.

It has some synchronized caches, and I suspect these are causing the
problem.

Is there any way of finding out how long threads spend waiting at
various synchronization points without a) instrumenting each one
manually or b) buying an expensive tool like Sitraka's Threadalyzer?

Thanks,
Tom
 
R

Roedy Green

Is there any way of finding out how long threads spend waiting at
various synchronization points without a) instrumenting each one
manually or b)

How about overriding Thread with methods that do some instrumentation.
Put it in your package. I have not tried this, but it is possible it
may prefer your version of Thread to java.lang.Thread.

If that does not work, just do a textual replace of Thread to
InstrumentedThread.
 
R

Roedy Green

How about overriding Thread with methods that do some instrumentation.
Put it in your package. I have not tried this, but it is possible it
may prefer your version of Thread to java.lang.Thread.

Your InstrumentedThread package could dump quite raw data to a file,
say a DataOutputStream or DataObjectStream. After the program has
finished you write something to analyse the log.
 
R

Robert Olofsson

Tom Davies ([email protected]) wrote:

: It has some synchronized caches, and I suspect these are causing the
: problem.
: Is there any way of finding out how long threads spend waiting at
: various synchronization points without a) instrumenting each one
: manually or b) buying an expensive tool like Sitraka's Threadalyzer?

My profiler, jmp, can watch monitors and time how long each thread
spends waiting to enter a synchronized block. You can also inspect
the thread (method) stacks and there see what method each thread is in
and which object it is waiting for.

JMP is free and open source, you can download it from:
http://www.khelekore.org/jmp/

/robo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top