< prev index next >

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

Print this page
rev 10297 : [mq]: webrev.01


  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc/g1/g1CollectedHeap.inline.hpp"
  27 #include "gc/g1/g1CollectorPolicy.hpp"
  28 #include "gc/g1/g1YoungRemSetSamplingThread.hpp"
  29 #include "gc/g1/suspendibleThreadSet.hpp"
  30 #include "runtime/mutexLocker.hpp"
  31 
  32 void G1YoungRemSetSamplingThread::run() {
  33   initialize_in_thread();
  34   wait_for_universe_init();
  35 
  36   run_service();
  37 
  38   terminate();
  39 }
  40 
  41 void G1YoungRemSetSamplingThread::stop() {
  42   // it is ok to take late safepoints here, if needed
  43   {
  44     MutexLockerEx mu(Terminator_lock);
  45     _should_terminate = true;
  46   }
  47 
  48   stop_service();
  49 
  50   {
  51     MutexLockerEx mu(Terminator_lock);
  52     while (!_has_terminated) {
  53       Terminator_lock->wait();
  54     }
  55   }
  56 }
  57 
  58 G1YoungRemSetSamplingThread::G1YoungRemSetSamplingThread() : ConcurrentGCThread() {
  59   _monitor = new Monitor(Mutex::nonleaf,
  60                          "G1YoungRemSetSamplingThread monitor",
  61                          true,
  62                          Monitor::_safepoint_check_never);
  63 
  64   set_name("G1 Young RemSet Sampling");
  65   create_and_start();
  66 }
  67 
  68 void G1YoungRemSetSamplingThread::sleep_before_next_cycle() {
  69   MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag);
  70   if (!_should_terminate) {
  71     intx waitms = G1ConcRefinementServiceIntervalMillis; // 300, really should be?
  72     _monitor->wait(Mutex::_no_safepoint_check_flag, waitms);
  73   }
  74 }
  75 
  76 void G1YoungRemSetSamplingThread::run_service() {
  77   double vtime_start = os::elapsedVTime();




  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc/g1/g1CollectedHeap.inline.hpp"
  27 #include "gc/g1/g1CollectorPolicy.hpp"
  28 #include "gc/g1/g1YoungRemSetSamplingThread.hpp"
  29 #include "gc/g1/suspendibleThreadSet.hpp"
  30 #include "runtime/mutexLocker.hpp"
  31 


























  32 G1YoungRemSetSamplingThread::G1YoungRemSetSamplingThread() : ConcurrentGCThread() {
  33   _monitor = new Monitor(Mutex::nonleaf,
  34                          "G1YoungRemSetSamplingThread monitor",
  35                          true,
  36                          Monitor::_safepoint_check_never);
  37 
  38   set_name("G1 Young RemSet Sampling");
  39   create_and_start();
  40 }
  41 
  42 void G1YoungRemSetSamplingThread::sleep_before_next_cycle() {
  43   MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag);
  44   if (!_should_terminate) {
  45     intx waitms = G1ConcRefinementServiceIntervalMillis; // 300, really should be?
  46     _monitor->wait(Mutex::_no_safepoint_check_flag, waitms);
  47   }
  48 }
  49 
  50 void G1YoungRemSetSamplingThread::run_service() {
  51   double vtime_start = os::elapsedVTime();


< prev index next >