From 6beb97f25bf1d62d347701e2dc38eed39788455f Mon Sep 17 00:00:00 2001 From: ysr Date: Mon, 22 Aug 2011 12:30:06 -0700 Subject: [PATCH] 6810861: G1: support -XX:+{PrintClassHistogram,HeapDump}{Before,After}FullGC Summary: Call {pre,post}_full_gc_dump() before and after a STW full gc of G1CollectedHeap. Also adjusted the prefix message, including the addition of missing whitespace. Reviewed-by: brutisso, tonyp --- src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp | 2 ++ src/share/vm/gc_interface/collectedHeap.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index b77047a04..48b017dc6 100644 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -1227,6 +1227,7 @@ bool G1CollectedHeap::do_collection(bool explicit_gc, /* option */ VerifyOption_G1UsePrevMarking); } + pre_full_gc_dump(); COMPILER2_PRESENT(DerivedPointerTable::clear()); @@ -1401,6 +1402,7 @@ bool G1CollectedHeap::do_collection(bool explicit_gc, Universe::print_heap_after_gc(); } g1mm()->update_counters(); + post_full_gc_dump(); return true; } diff --git a/src/share/vm/gc_interface/collectedHeap.cpp b/src/share/vm/gc_interface/collectedHeap.cpp index 6b99a8f62..f08075497 100644 --- a/src/share/vm/gc_interface/collectedHeap.cpp +++ b/src/share/vm/gc_interface/collectedHeap.cpp @@ -404,13 +404,13 @@ void CollectedHeap::resize_all_tlabs() { void CollectedHeap::pre_full_gc_dump() { if (HeapDumpBeforeFullGC) { - TraceTime tt("Heap Dump: ", PrintGCDetails, false, gclog_or_tty); + TraceTime tt("Heap Dump (before full gc): ", PrintGCDetails, false, gclog_or_tty); // We are doing a "major" collection and a heap dump before // major collection has been requested. HeapDumper::dump_heap(); } if (PrintClassHistogramBeforeFullGC) { - TraceTime tt("Class Histogram: ", PrintGCDetails, true, gclog_or_tty); + TraceTime tt("Class Histogram (before full gc): ", PrintGCDetails, true, gclog_or_tty); VM_GC_HeapInspection inspector(gclog_or_tty, false /* ! full gc */, false /* ! prologue */); inspector.doit(); } @@ -418,11 +418,11 @@ void CollectedHeap::pre_full_gc_dump() { void CollectedHeap::post_full_gc_dump() { if (HeapDumpAfterFullGC) { - TraceTime tt("Heap Dump", PrintGCDetails, false, gclog_or_tty); + TraceTime tt("Heap Dump (after full gc): ", PrintGCDetails, false, gclog_or_tty); HeapDumper::dump_heap(); } if (PrintClassHistogramAfterFullGC) { - TraceTime tt("Class Histogram", PrintGCDetails, true, gclog_or_tty); + TraceTime tt("Class Histogram (after full gc): ", PrintGCDetails, true, gclog_or_tty); VM_GC_HeapInspection inspector(gclog_or_tty, false /* ! full gc */, false /* ! prologue */); inspector.doit(); } -- GitLab