Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8348833

Remove ObjectMonitor perf counters

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Unresolved
    • Icon: P4 P4
    • 25
    • hotspot
    • None
    • behavioral
    • low
    • Removes internal performance counters. These counters can be accessed through internal APIs or jcmd.
    • Other
    • JDK

      Summary

      Remove ObjectMonitor performance counters, exposed in sun.rt._sync* namespace.

      Problem

      There is a bunch of ObjectMonitor performance counters:

      PerfCounter * ObjectMonitor::_sync_ContendedLockAttempts = nullptr;
      PerfCounter * ObjectMonitor::_sync_FutileWakeups = nullptr;
      PerfCounter * ObjectMonitor::_sync_Parks = nullptr;
      PerfCounter * ObjectMonitor::_sync_Notifications = nullptr;
      PerfCounter * ObjectMonitor::_sync_Inflations = nullptr;
      PerfCounter * ObjectMonitor::_sync_Deflations = nullptr;
      PerfLongVariable * ObjectMonitor::_sync_MonExtant = nullptr; 

      They seem to be seldom used, and their continued maintenance comes with at least two problems, both of which come down to intrinsic race against VM shutdown, see JDK-8049304 and JDK-8348402. Additionally, these get updated on locking paths, and attempts to do extra things, including synchronization, might obscure some of the bugs.

      Some of these counters are covered by related JFR events:

      • _sync_ContendedLockAttempts: covered by existing JavaMonitorEnter event
      • _sync_FutileWakeups: not covered, we think this is unnecessary to track
      • _sync_Parks: covered by existing JavaMonitorWait event
      • _sync_Notifications: covered by new JavaMonitorNotify event (JDK-8351187)
      • _sync_Inflations: covered by existing JavaMonitorInflate event
      • _sync_Deflations: covered by new JavaMonitorDeflate event (JDK-8351142)
      • _sync_MonExtant: covered by new JavaMonitorStatistics event (JDK-8351142)

      These counters are also accessible through internal APIs or jcmd:

      % jcmd 8090 PerfCounter.print | grep _sync
      sun.rt._sync_ContendedLockAttempts=10045275
      sun.rt._sync_Deflations=222972
      sun.rt._sync_FutileWakeups=4184363
      sun.rt._sync_Inflations=222991
      sun.rt._sync_MonExtant=7
      sun.rt._sync_Notifications=1521211
      sun.rt._sync_Parks=7667155

      Solution

      The solution is to remove these counters.

      Specification

      All counters in sun.rt._sync* would be gone, see related PR: https://github.com/openjdk/jdk/pull/23326

            shade Aleksey Shipilev
            shade Aleksey Shipilev
            Coleen Phillimore
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: