hotspot/src/share/vm/runtime/synchronizer.cpp
changeset 46541 d20828de9e39
parent 46495 34f7d403039f
child 46587 6c97f34cb194
--- a/hotspot/src/share/vm/runtime/synchronizer.cpp	Wed Jun 14 08:47:27 2017 +0200
+++ b/hotspot/src/share/vm/runtime/synchronizer.cpp	Thu Jun 15 09:52:44 2017 +0200
@@ -962,6 +962,21 @@
   return block;
 }
 
+static bool monitors_used_above_threshold() {
+  if (gMonitorPopulation == 0) {
+    return false;
+  }
+  int monitors_used = gMonitorPopulation - gMonitorFreeCount;
+  int monitor_usage = (monitors_used * 100LL) / gMonitorPopulation;
+  return monitor_usage > MonitorUsedDeflationThreshold;
+}
+
+bool ObjectSynchronizer::is_cleanup_needed() {
+  if (MonitorUsedDeflationThreshold > 0) {
+    return monitors_used_above_threshold();
+  }
+  return false;
+}
 
 void ObjectSynchronizer::oops_do(OopClosure* f) {
   if (MonitorInUseLists) {