< prev index next >

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

Print this page
rev 10472 : 8151711: Move G1 number sequences out of the G1 collector policy
Reviewed-by:
rev 10473 : [mq]: rename-to-analytics


   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  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 "classfile/classLoaderData.hpp"
  27 #include "gc/g1/concurrentMarkThread.inline.hpp"

  28 #include "gc/g1/g1CollectedHeap.inline.hpp"
  29 #include "gc/g1/g1CollectorPolicy.hpp"
  30 #include "gc/g1/g1MMUTracker.hpp"
  31 #include "gc/g1/suspendibleThreadSet.hpp"
  32 #include "gc/g1/vm_operations_g1.hpp"
  33 #include "gc/shared/gcId.hpp"
  34 #include "gc/shared/gcTrace.hpp"
  35 #include "gc/shared/gcTraceTime.inline.hpp"
  36 #include "logging/log.hpp"
  37 #include "memory/resourceArea.hpp"
  38 #include "runtime/vmThread.hpp"
  39 
  40 // ======= Concurrent Mark Thread ========
  41 
  42 // The CM thread is created when the G1 garbage collector is used
  43 
  44 SurrogateLockerThread*
  45      ConcurrentMarkThread::_slt = NULL;
  46 
  47 ConcurrentMarkThread::ConcurrentMarkThread(G1ConcurrentMark* cm) :


  65 
  66   void do_void(){
  67     _cm->checkpointRootsFinal(false); // !clear_all_soft_refs
  68   }
  69 };
  70 
  71 class CMCleanUp: public VoidClosure {
  72   G1ConcurrentMark* _cm;
  73 public:
  74 
  75   CMCleanUp(G1ConcurrentMark* cm) :
  76     _cm(cm) {}
  77 
  78   void do_void(){
  79     _cm->cleanup();
  80   }
  81 };
  82 
  83 // Marking pauses can be scheduled flexibly, so we might delay marking to meet MMU.
  84 void ConcurrentMarkThread::delay_to_keep_mmu(G1CollectorPolicy* g1_policy, bool remark) {

  85   if (g1_policy->adaptive_young_list_length()) {
  86     double now = os::elapsedTime();
  87     double prediction_ms = remark ? g1_policy->predict_remark_time_ms()
  88                                   : g1_policy->predict_cleanup_time_ms();
  89     G1MMUTracker *mmu_tracker = g1_policy->mmu_tracker();
  90     jlong sleep_time_ms = mmu_tracker->when_ms(now, prediction_ms);
  91     os::sleep(this, sleep_time_ms, false);
  92   }
  93 }
  94 
  95 class GCConcPhaseTimer : StackObj {
  96   G1ConcurrentMark* _cm;
  97 
  98  public:
  99   GCConcPhaseTimer(G1ConcurrentMark* cm, const char* title) : _cm(cm) {
 100     _cm->register_concurrent_phase_start(title);
 101   }
 102 
 103   ~GCConcPhaseTimer() {
 104     _cm->register_concurrent_phase_end();
 105   }
 106 };
 107 
 108 void ConcurrentMarkThread::run() {




   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  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 "classfile/classLoaderData.hpp"
  27 #include "gc/g1/concurrentMarkThread.inline.hpp"
  28 #include "gc/g1/g1Analytics.hpp"
  29 #include "gc/g1/g1CollectedHeap.inline.hpp"
  30 #include "gc/g1/g1CollectorPolicy.hpp"
  31 #include "gc/g1/g1MMUTracker.hpp"
  32 #include "gc/g1/suspendibleThreadSet.hpp"
  33 #include "gc/g1/vm_operations_g1.hpp"
  34 #include "gc/shared/gcId.hpp"
  35 #include "gc/shared/gcTrace.hpp"
  36 #include "gc/shared/gcTraceTime.inline.hpp"
  37 #include "logging/log.hpp"
  38 #include "memory/resourceArea.hpp"
  39 #include "runtime/vmThread.hpp"
  40 
  41 // ======= Concurrent Mark Thread ========
  42 
  43 // The CM thread is created when the G1 garbage collector is used
  44 
  45 SurrogateLockerThread*
  46      ConcurrentMarkThread::_slt = NULL;
  47 
  48 ConcurrentMarkThread::ConcurrentMarkThread(G1ConcurrentMark* cm) :


  66 
  67   void do_void(){
  68     _cm->checkpointRootsFinal(false); // !clear_all_soft_refs
  69   }
  70 };
  71 
  72 class CMCleanUp: public VoidClosure {
  73   G1ConcurrentMark* _cm;
  74 public:
  75 
  76   CMCleanUp(G1ConcurrentMark* cm) :
  77     _cm(cm) {}
  78 
  79   void do_void(){
  80     _cm->cleanup();
  81   }
  82 };
  83 
  84 // Marking pauses can be scheduled flexibly, so we might delay marking to meet MMU.
  85 void ConcurrentMarkThread::delay_to_keep_mmu(G1CollectorPolicy* g1_policy, bool remark) {
  86   const G1Analytics* analytics = g1_policy->analytics();
  87   if (g1_policy->adaptive_young_list_length()) {
  88     double now = os::elapsedTime();
  89     double prediction_ms = remark ? analytics->predict_remark_time_ms()
  90                                   : analytics->predict_cleanup_time_ms();
  91     G1MMUTracker *mmu_tracker = g1_policy->mmu_tracker();
  92     jlong sleep_time_ms = mmu_tracker->when_ms(now, prediction_ms);
  93     os::sleep(this, sleep_time_ms, false);
  94   }
  95 }
  96 
  97 class GCConcPhaseTimer : StackObj {
  98   G1ConcurrentMark* _cm;
  99 
 100  public:
 101   GCConcPhaseTimer(G1ConcurrentMark* cm, const char* title) : _cm(cm) {
 102     _cm->register_concurrent_phase_start(title);
 103   }
 104 
 105   ~GCConcPhaseTimer() {
 106     _cm->register_concurrent_phase_end();
 107   }
 108 };
 109 
 110 void ConcurrentMarkThread::run() {


< prev index next >