< prev index next >

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

Print this page
rev 12508 : imported patch 8162104-use-is_in_cset-instead-of-obj_in_cs
rev 12512 : imported patch 8155094-logging-for-long-lasting-methods
rev 12513 : [mq]: 8155094-kim-review

@@ -1376,14 +1376,13 @@
         GCTraceTime(Debug, gc)("Clear Bitmap for Verification");
         _cm->clear_prev_bitmap(workers());
       }
       _verifier->check_bitmaps("Full GC End");
 
-      // Start a new incremental collection set for the next pause
-      collection_set()->start_incremental_building();
-
-      clear_cset_fast_test();
+      double start = os::elapsedTime();
+      start_new_collection_set();
+      g1_policy()->phase_times()->record_start_new_cset_time_ms((os::elapsedTime() - start) * 1000.0);
 
       _allocator->init_mutator_alloc_region();
 
       g1_policy()->record_full_collection_end();
 

@@ -2692,13 +2691,16 @@
 }
 
 void G1CollectedHeap::gc_prologue(bool full /* Ignored */) {
   // always_do_update_barrier = false;
   assert(InlineCacheBuffer::is_empty(), "should have cleaned up ICBuffer");
+
+  double start = os::elapsedTime();
   // Fill TLAB's and such
   accumulate_statistics_all_tlabs();
   ensure_parsability(true);
+  g1_policy()->phase_times()->record_prepare_tlab_time_ms((os::elapsedTime() - start) * 1000.0);
 
   g1_rem_set()->print_periodic_summary_info("Before GC RS summary", total_collections());
 }
 
 void G1CollectedHeap::gc_epilogue(bool full) {

@@ -2711,11 +2713,14 @@
 #if defined(COMPILER2) || INCLUDE_JVMCI
   assert(DerivedPointerTable::is_empty(), "derived pointer present");
 #endif
   // always_do_update_barrier = true;
 
+  double start = os::elapsedTime();
   resize_all_tlabs();
+  g1_policy()->phase_times()->record_resize_tlab_time_ms((os::elapsedTime() - start) * 1000.0);
+
   allocation_context_stats().update(full);
 
   // We have just completed a GC. Update the soft reference
   // policy with the new heap occupancy
   Universe::update_heap_info_at_gc();

@@ -2994,10 +2999,19 @@
     _hr_printer->cset(r);
     return false;
   }
 };
 
+void G1CollectedHeap::start_new_collection_set() {
+  collection_set()->start_incremental_building();
+    
+  clear_cset_fast_test();
+    
+  guarantee(_eden.length() == 0, "eden should have been cleared");
+  g1_policy()->transfer_survivors_to_cset(survivor());
+}
+
 bool
 G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
   assert_at_safepoint(true /* should_be_vm_thread */);
   guarantee(!is_gc_active(), "collection is not reentrant");
 

@@ -3196,17 +3210,11 @@
 
         record_obj_copy_mem_stats();
         _survivor_evac_stats.adjust_desired_plab_sz();
         _old_evac_stats.adjust_desired_plab_sz();
 
-        // Start a new incremental collection set for the next pause.
-        collection_set()->start_incremental_building();
-
-        clear_cset_fast_test();
-
-        guarantee(_eden.length() == 0, "eden should have been cleared");
-        g1_policy()->transfer_survivors_to_cset(survivor());
+        start_new_collection_set();
 
         if (evacuation_failed()) {
           set_used(recalculate_used());
           if (_archive_allocator != NULL) {
             _archive_allocator->clear_used();

@@ -4520,11 +4528,13 @@
 
   purge_code_root_memory();
 
   redirty_logged_cards();
 #if defined(COMPILER2) || INCLUDE_JVMCI
+  double start = os::elapsedTime();
   DerivedPointerTable::update_pointers();
+  g1_policy()->phase_times()->record_derived_pointer_table_update_time((os::elapsedTime() - start) * 1000.0);
 #endif
   g1_policy()->print_age_table();
 }
 
 void G1CollectedHeap::record_obj_copy_mem_stats() {
< prev index next >