src/hotspot/share/gc/z/zDirector.cpp
changeset 59148 877c000fd688
parent 58701 5d10ba4a0468
equal deleted inserted replaced
59147:e735301d76b9 59148:877c000fd688
    73   // Perform GC if heap usage passes 10/20/30% and no other GC has been
    73   // Perform GC if heap usage passes 10/20/30% and no other GC has been
    74   // performed yet. This allows us to get some early samples of the GC
    74   // performed yet. This allows us to get some early samples of the GC
    75   // duration, which is needed by the other rules.
    75   // duration, which is needed by the other rules.
    76   const size_t max_capacity = ZHeap::heap()->soft_max_capacity();
    76   const size_t max_capacity = ZHeap::heap()->soft_max_capacity();
    77   const size_t used = ZHeap::heap()->used();
    77   const size_t used = ZHeap::heap()->used();
    78   const double used_threshold_percent = (ZStatCycle::ncycles() + 1) * 0.1;
    78   const double used_threshold_percent = (ZStatCycle::nwarmup_cycles() + 1) * 0.1;
    79   const size_t used_threshold = max_capacity * used_threshold_percent;
    79   const size_t used_threshold = max_capacity * used_threshold_percent;
    80 
    80 
    81   log_debug(gc, director)("Rule: Warmup %.0f%%, Used: " SIZE_FORMAT "MB, UsedThreshold: " SIZE_FORMAT "MB",
    81   log_debug(gc, director)("Rule: Warmup %.0f%%, Used: " SIZE_FORMAT "MB, UsedThreshold: " SIZE_FORMAT "MB",
    82                           used_threshold_percent * 100, used / M, used_threshold / M);
    82                           used_threshold_percent * 100, used / M, used_threshold / M);
    83 
    83 
    84   return used >= used_threshold;
    84   return used >= used_threshold;
    85 }
    85 }
    86 
    86 
    87 bool ZDirector::rule_allocation_rate() const {
    87 bool ZDirector::rule_allocation_rate() const {
    88   if (ZStatCycle::is_first()) {
    88   if (!ZStatCycle::is_normalized_duration_trustable()) {
    89     // Rule disabled
    89     // Rule disabled
    90     return false;
    90     return false;
    91   }
    91   }
    92 
    92 
    93   // Perform GC if the estimated max allocation rate indicates that we
    93   // Perform GC if the estimated max allocation rate indicates that we