< prev index next >

src/hotspot/share/gc/g1/g1YoungRemSetSamplingThread.cpp

Print this page




  84 
  85 void G1YoungRemSetSamplingThread::check_for_periodic_gc(){
  86   // If disabled, just return.
  87   if (G1PeriodicGCInterval == 0) {
  88     return;
  89   }
  90   if ((os::elapsedTime() - _last_periodic_gc_attempt_s) > (G1PeriodicGCInterval / 1000.0)) {
  91     log_debug(gc, periodic)("Checking for periodic GC.");
  92     if (should_start_periodic_gc()) {
  93       if (!G1CollectedHeap::heap()->try_collect(GCCause::_g1_periodic_collection)) {
  94         log_debug(gc, periodic)("GC request denied. Skipping.");
  95       }
  96     }
  97     _last_periodic_gc_attempt_s = os::elapsedTime();
  98   }
  99 }
 100 
 101 void G1YoungRemSetSamplingThread::run_service() {
 102   double vtime_start = os::elapsedVTime();
 103 
 104   // Print a message about periodic GC configuration.
 105   if (G1PeriodicGCInterval != 0) {
 106     log_info(gc)("Periodic GC enabled with interval " UINTX_FORMAT "ms", G1PeriodicGCInterval);
 107   } else {
 108     log_info(gc)("Periodic GC disabled");
 109   }
 110 
 111   while (!should_terminate()) {
 112     sample_young_list_rs_length();
 113 
 114     if (os::supports_vtime()) {
 115       _vtime_accum = (os::elapsedVTime() - vtime_start);
 116     } else {
 117       _vtime_accum = 0.0;
 118     }
 119 
 120     check_for_periodic_gc();
 121 
 122     sleep_before_next_cycle();
 123   }
 124 }
 125 
 126 void G1YoungRemSetSamplingThread::stop_service() {
 127   MutexLocker x(&_monitor, Mutex::_no_safepoint_check_flag);
 128   _monitor.notify();
 129 }
 130 




  84 
  85 void G1YoungRemSetSamplingThread::check_for_periodic_gc(){
  86   // If disabled, just return.
  87   if (G1PeriodicGCInterval == 0) {
  88     return;
  89   }
  90   if ((os::elapsedTime() - _last_periodic_gc_attempt_s) > (G1PeriodicGCInterval / 1000.0)) {
  91     log_debug(gc, periodic)("Checking for periodic GC.");
  92     if (should_start_periodic_gc()) {
  93       if (!G1CollectedHeap::heap()->try_collect(GCCause::_g1_periodic_collection)) {
  94         log_debug(gc, periodic)("GC request denied. Skipping.");
  95       }
  96     }
  97     _last_periodic_gc_attempt_s = os::elapsedTime();
  98   }
  99 }
 100 
 101 void G1YoungRemSetSamplingThread::run_service() {
 102   double vtime_start = os::elapsedVTime();
 103 







 104   while (!should_terminate()) {
 105     sample_young_list_rs_length();
 106 
 107     if (os::supports_vtime()) {
 108       _vtime_accum = (os::elapsedVTime() - vtime_start);
 109     } else {
 110       _vtime_accum = 0.0;
 111     }
 112 
 113     check_for_periodic_gc();
 114 
 115     sleep_before_next_cycle();
 116   }
 117 }
 118 
 119 void G1YoungRemSetSamplingThread::stop_service() {
 120   MutexLocker x(&_monitor, Mutex::_no_safepoint_check_flag);
 121   _monitor.notify();
 122 }
 123 


< prev index next >