Profile the lock usage in openjdk

David Holmes david.holmes at
Tue Mar 4 04:14:13 UTC 2014

On 4/03/2014 1:48 PM, Junjie Qian wrote:
> Dear all,
> I am one graduate student working on Java VM, and would like to study the multithread in Java benchmarks. The information I want to get is the lock contentions in the benchmark, such as fatlock/thinLock/SpinLock number, or the time spent on waiting for these lock.
> Could you give me some advices on this, as how to insert code in openjdk to get such info?

You will find that there is already a lot of information gathered within 
the VM, but some probably only for non-product builds and most only for 
the contention case where the monitor is inflated. The problem with 
overly instrumenting the lock code to "measure" contention is that the 
instrumentation code completely changes the contention patterns. Adding 
additional instrumentation is non-trivial as you need to handle both 
interpreted and JIT'd code.


> Thanks!
> Best
> Junjie

More information about the hotspot-dev mailing list