Search code examples
javamultithreadingjvmjconsolejvisualvm

Measure thread contention on particular monitor


I'm considering switching from synchronized to a ReadWriteLock. Before doing it, I would like to check if it's worth it.

ThreadMXBean and ThreadInfo provide information about overall thread blocked count and time. Those blocks can be caused by multiple monitors. Is there a way to measure block statistics given a particular monitor object?


Solution

  • jmc, yourkit and jprofiler all provide lock contention profiling.