Monitoring monitors using JVMPI

S

Shachar

Hi,

I'm trying to monitor threads locking locks using the 'synchronized'
keyword and JVMPI. JVMPI provides three contention events for a Java
monitor (ENTER, ENTERED and EXITED). It means I get an event only when
there's a contention, i.e. another thread is involved.

What if I want to know about a single thread entering, leaving or
holding a lock? How can I do it using JVMPI and receive an event about
it?

I saw there is a monitor dump, but that is a specific request that I
have to make, whether I would like to be notified about it.

If there is no good answer, is there a way, while getting notified by
the three mentioned events, to know from the object received which
thread is locking it?

Thank you,
Shachar
 
Y

Yotam

Hi,

I am doing academic research on this matter in MIT, and have also
pondered about this behaviour. One would like to know the behaviour in
idle-like states, and not only during contention.

I'm sorry I can't enlighten you further of this conundrum, but hope
someone will have a tip for you on this matter.

Let me know if you make progress,
Yotam
 
C

Chris Uppal

Shachar said:
What if I want to know about a single thread entering, leaving or
holding a lock? How can I do it using JVMPI and receive an event about
it?

The following quote from the JVMTI documentation (that's the feature in JDK1.5
that is a replacement for both JVMPI and JVMDI) may help:

======
This interface does not include some events that one might expect in an
interface with profiling support. Some examples include object allocation
events and full speed method enter and exit events. The interface instead
provides support for bytecode instrumentation, the ability to alter the Java
virtual machine bytecode instructions which comprise the target program.
Typically, these alterations are to add "events" to the code of a method - for
example, to add, at the beginning of a method, a call to
MyProfiler.methodEntered(). Since the changes are purely additive, they do not
modify application state or behavior

======

-- chris
 

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

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,816
Latest member
nipsseyhussle

Latest Threads

Top