Monitoring lock contention on Java applications

拥有回忆 提交于 2019-12-03 08:47:35

Your command displays statistics for the main thread only, child PIDs are not counted.

Hotspot JVM has internal synchronization counters, but some magic is needed in order to unlock them:

  1. Run jconsole.exe -J-Djconsole.showUnsupported and connect to your JVM.
  2. Select Connection -> Hotspot MBeans -> Create from the main menu.
  3. Open sun.management.HotspotRuntime on the MBeans tab.
  4. You'll find a bunch of counters under InternalRuntimeCounters attribute:
    • sun.rt._sync_ContendedLockAttempts
    • sun.rt._sync_Parks
    • sun.rt._sync_Notifications
    • sun.rt._sync_Inflations
      etc.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!