< prev index next >

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

Print this page

        

@@ -36,10 +36,11 @@
 #include "gc/g1/g1CollectedHeap.inline.hpp"
 #include "gc/g1/g1CollectorPolicy.hpp"
 #include "gc/g1/g1CollectorState.hpp"
 #include "gc/g1/g1EvacStats.inline.hpp"
 #include "gc/g1/g1GCPhaseTimes.hpp"
+#include "gc/g1/g1HeapTransition.hpp"
 #include "gc/g1/g1HeapVerifier.hpp"
 #include "gc/g1/g1MarkSweep.hpp"
 #include "gc/g1/g1OopClosures.inline.hpp"
 #include "gc/g1/g1ParScanThreadState.inline.hpp"
 #include "gc/g1/g1RegionToSpaceMapper.hpp"

@@ -1248,10 +1249,11 @@
     {
       GCTraceTime(Info, gc) tm("Pause Full", NULL, gc_cause(), true);
       TraceCollectorStats tcs(g1mm()->full_collection_counters());
       TraceMemoryManagerStats tms(true /* fullGC */, gc_cause());
 
+      G1HeapTransition heap_transition(this);
       g1_policy()->record_full_collection_start();
 
       // Note: When we have a more flexible GC logging framework that
       // allows us to add optional attributes to a GC log record we
       // could consider timing and reporting how long we wait in the

@@ -1440,18 +1442,18 @@
       // TraceMemoryManagerStats is called) so that the G1 memory pools are updated
       // before any GC notifications are raised.
       g1mm()->update_sizes();
 
       gc_epilogue(true);
-    }
 
-    g1_policy()->print_detailed_heap_transition();
+      heap_transition.print();
 
     print_heap_after_gc();
     trace_heap_after_gc(gc_tracer);
 
     post_full_gc_dump(gc_timer);
+    }
 
     gc_timer->register_gc_end();
     gc_tracer->report_gc_end(gc_timer->gc_end(), gc_timer->time_partitions());
   }
 

@@ -3167,21 +3169,10 @@
     task_queue(i)->stats.reset();
   }
 }
 #endif // TASKQUEUE_STATS
 
-void G1CollectedHeap::log_gc_footer() {
-  if (evacuation_failed()) {
-    log_info(gc)("To-space exhausted");
-  }
-
-  g1_policy()->print_phases();
-
-  g1_policy()->print_detailed_heap_transition();
-}
-
-
 void G1CollectedHeap::wait_for_root_region_scanning() {
   double scan_wait_start = os::elapsedTime();
   // We have to wait until the CM threads finish scanning the
   // root regions as it's the only way to ensure that all the
   // objects on them have been correctly scanned before we start

@@ -3279,10 +3270,13 @@
     // get entries from the secondary_free_list.
     if (!G1StressConcRegionFreeing) {
       append_secondary_free_list_if_not_empty_with_lock();
     }
 
+    G1HeapTransition heap_transition(this);
+    size_t heap_used_bytes_before_gc = used();
+
     assert(check_young_list_well_formed(), "young list should be well formed");
 
     // Don't dynamically change the number of GC threads this early.  A value of
     // 0 is used to indicate serial work.  When parallel work is done,
     // it will be set.

@@ -3472,11 +3466,11 @@
         // It is unclear why this should not include the full pause. We will
         // investigate this in CR 7178365.
         double sample_end_time_sec = os::elapsedTime();
         double pause_time_ms = (sample_end_time_sec - sample_start_time_sec) * MILLIUNITS;
         size_t total_cards_scanned = per_thread_states.total_cards_scanned();
-        g1_policy()->record_collection_pause_end(pause_time_ms, total_cards_scanned);
+        g1_policy()->record_collection_pause_end(pause_time_ms, total_cards_scanned, heap_used_bytes_before_gc);
 
         evacuation_info.set_collectionset_used_before(g1_policy()->collection_set_bytes_used_before());
         evacuation_info.set_bytes_copied(g1_policy()->bytes_copied_during_gc());
 
         MemoryService::track_memory_usage();

@@ -3525,11 +3519,16 @@
 
       gc_epilogue(false);
     }
 
     // Print the remainder of the GC log output.
-    log_gc_footer();
+    if (evacuation_failed()) {
+      log_info(gc)("To-space exhausted");
+    }
+
+    g1_policy()->print_phases();
+    heap_transition.print();
 
     // It is not yet to safe to tell the concurrent mark to
     // start as we have some optional output below. We don't want the
     // output from the concurrent mark thread interfering with this
     // logging output either.
< prev index next >