< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahHeuristics.cpp

Print this page
rev 55538 : 8226757: Shenandoah: Make Traversal a separate mode


 211 void ShenandoahHeuristics::record_gc_end() {
 212   // Do nothing
 213 }
 214 
 215 void ShenandoahHeuristics::record_cycle_start() {
 216   _cycle_start = os::elapsedTime();
 217 }
 218 
 219 void ShenandoahHeuristics::record_cycle_end() {
 220   _last_cycle_end = os::elapsedTime();
 221 }
 222 
 223 void ShenandoahHeuristics::record_phase_time(ShenandoahPhaseTimings::Phase phase, double secs) {
 224   // Do nothing
 225 }
 226 
 227 bool ShenandoahHeuristics::should_start_update_refs() {
 228   return _update_refs_early;
 229 }
 230 
 231 bool ShenandoahHeuristics::should_start_normal_gc() const {
 232   // Perform GC to cleanup metaspace
 233   if (has_metaspace_oom()) {
 234     // Some of vmTestbase/metaspace tests depend on following line to count GC cycles
 235     log_info(gc)("Trigger: %s", GCCause::to_string(GCCause::_metadata_GC_threshold));
 236     return true;
 237   }
 238 
 239   double last_time_ms = (os::elapsedTime() - _last_cycle_end) * 1000;
 240   bool periodic_gc = (last_time_ms > ShenandoahGuaranteedGCInterval);
 241   if (periodic_gc) {
 242     log_info(gc)("Trigger: Time since last GC (%.0f ms) is larger than guaranteed interval (" UINTX_FORMAT " ms)",
 243                   last_time_ms, ShenandoahGuaranteedGCInterval);
 244   }
 245   return periodic_gc;
 246 }
 247 
 248 bool ShenandoahHeuristics::should_start_traversal_gc() {
 249   return false;
 250 }
 251 
 252 bool ShenandoahHeuristics::can_do_traversal_gc() {
 253   return false;
 254 }
 255 
 256 bool ShenandoahHeuristics::should_degenerate_cycle() {
 257   return _degenerated_cycles_in_a_row <= ShenandoahFullGCThreshold;
 258 }
 259 
 260 void ShenandoahHeuristics::record_success_concurrent() {
 261   _degenerated_cycles_in_a_row = 0;
 262   _successful_cycles_in_a_row++;
 263 
 264   _gc_time_history->add(time_since_last_gc());
 265   _gc_times_learned++;
 266   _gc_time_penalties -= MIN2<size_t>(_gc_time_penalties, Concurrent_Adjust);
 267 }
 268 
 269 void ShenandoahHeuristics::record_success_degenerated() {
 270   _degenerated_cycles_in_a_row++;
 271   _successful_cycles_in_a_row = 0;
 272   _gc_time_penalties += Degenerated_Penalty;
 273 }




 211 void ShenandoahHeuristics::record_gc_end() {
 212   // Do nothing
 213 }
 214 
 215 void ShenandoahHeuristics::record_cycle_start() {
 216   _cycle_start = os::elapsedTime();
 217 }
 218 
 219 void ShenandoahHeuristics::record_cycle_end() {
 220   _last_cycle_end = os::elapsedTime();
 221 }
 222 
 223 void ShenandoahHeuristics::record_phase_time(ShenandoahPhaseTimings::Phase phase, double secs) {
 224   // Do nothing
 225 }
 226 
 227 bool ShenandoahHeuristics::should_start_update_refs() {
 228   return _update_refs_early;
 229 }
 230 
 231 bool ShenandoahHeuristics::should_start_gc() const {
 232   // Perform GC to cleanup metaspace
 233   if (has_metaspace_oom()) {
 234     // Some of vmTestbase/metaspace tests depend on following line to count GC cycles
 235     log_info(gc)("Trigger: %s", GCCause::to_string(GCCause::_metadata_GC_threshold));
 236     return true;
 237   }
 238 
 239   double last_time_ms = (os::elapsedTime() - _last_cycle_end) * 1000;
 240   bool periodic_gc = (last_time_ms > ShenandoahGuaranteedGCInterval);
 241   if (periodic_gc) {
 242     log_info(gc)("Trigger: Time since last GC (%.0f ms) is larger than guaranteed interval (" UINTX_FORMAT " ms)",
 243                   last_time_ms, ShenandoahGuaranteedGCInterval);
 244   }
 245   return periodic_gc;








 246 }
 247 
 248 bool ShenandoahHeuristics::should_degenerate_cycle() {
 249   return _degenerated_cycles_in_a_row <= ShenandoahFullGCThreshold;
 250 }
 251 
 252 void ShenandoahHeuristics::record_success_concurrent() {
 253   _degenerated_cycles_in_a_row = 0;
 254   _successful_cycles_in_a_row++;
 255 
 256   _gc_time_history->add(time_since_last_gc());
 257   _gc_times_learned++;
 258   _gc_time_penalties -= MIN2<size_t>(_gc_time_penalties, Concurrent_Adjust);
 259 }
 260 
 261 void ShenandoahHeuristics::record_success_degenerated() {
 262   _degenerated_cycles_in_a_row++;
 263   _successful_cycles_in_a_row = 0;
 264   _gc_time_penalties += Degenerated_Penalty;
 265 }


< prev index next >