< prev index next >

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

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

@@ -88,10 +88,24 @@
     G1MMUTracker *mmu_tracker = g1_policy->mmu_tracker();
     jlong sleep_time_ms = mmu_tracker->when_ms(now, prediction_ms);
     os::sleep(this, sleep_time_ms, false);
   }
 }
+
+class GCConcPhaseTimer : StackObj {
+  ConcurrentMark* _cm;
+
+ public:
+  GCConcPhaseTimer(ConcurrentMark* cm, const char* title) : _cm(cm) {
+    _cm->register_concurrent_phase_start(title);
+  }
+
+  ~GCConcPhaseTimer() {
+    _cm->register_concurrent_phase_end();
+  }
+};
+
 void ConcurrentMarkThread::run() {
   initialize_in_thread();
   wait_for_universe_init();
 
   run_service();

@@ -125,10 +139,11 @@
       // subsequent GC could block us from joining the STS and proceed
       // without the root regions have been scanned which would be a
       // correctness issue.
 
       if (!cm()->has_aborted()) {
+        GCConcPhaseTimer(_cm, "Concurrent Root Region Scanning");
         _cm->scanRootRegions();
       }
 
       // It would be nice to use the GCTraceConcTime class here but
       // the "end" logging is inside the loop and not at the end of

@@ -138,10 +153,11 @@
 
       int iter = 0;
       do {
         iter++;
         if (!cm()->has_aborted()) {
+          GCConcPhaseTimer(_cm, "Concurrent Mark");
           _cm->markFromRoots();
         }
 
         double mark_end_time = os::elapsedVTime();
         jlong mark_end = os::elapsed_counter();

@@ -192,10 +208,11 @@
         // case they are needed by the pause. If a Full GC takes
         // place, it would wait for us to process the regions
         // reclaimed by cleanup.
 
         GCTraceConcTime(Info, gc) tt("Concurrent Cleanup");
+        GCConcPhaseTimer(_cm, "Concurrent Cleanup");
 
         // Now do the concurrent cleanup operation.
         _cm->completeCleanup();
 
         // Notify anyone who's waiting that there are no more free

@@ -248,10 +265,11 @@
       // We now want to allow clearing of the marking bitmap to be
       // suspended by a collection pause.
       // We may have aborted just before the remark. Do not bother clearing the
       // bitmap then, as it has been done during mark abort.
       if (!cm()->has_aborted()) {
+        GCConcPhaseTimer(_cm, "Concurrent Bitmap Clearing");
         _cm->clearNextBitmap();
       } else {
         assert(!G1VerifyBitmaps || _cm->nextMarkBitmapIsClear(), "Next mark bitmap must be clear");
       }
     }
< prev index next >