changeset 3891:0f80645e9c26

8004170: G1: Verbose GC output is not getting flushed to log file using JDK 8 Summary: Add flushes to G1CollectedHeap::log_gc_footer() and TraceCPUTime destructor. Reviewed-by: jwilhelm, azeemj, brutisso
author johnc
date Fri, 30 Nov 2012 11:46:17 -0800
parents 816b7e5bf2ed
children eade6b2e4782
files src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp src/share/vm/runtime/timer.cpp
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri Nov 30 17:00:32 2012 -0800
+++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri Nov 30 11:46:17 2012 -0800
@@ -3690,6 +3690,7 @@
     g1_policy()->print_heap_transition();
     gclog_or_tty->print_cr(", %3.7f secs]", pause_time_sec);
   }
+  gclog_or_tty->flush();
 }
 
 bool
@@ -4036,10 +4037,11 @@
 #endif
 
       gc_epilogue(false);
-
-      log_gc_footer(os::elapsedTime() - pause_start_sec);
     }
 
+    // Print the remainder of the GC log output.
+    log_gc_footer(os::elapsedTime() - pause_start_sec);
+
     // 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
--- a/src/share/vm/runtime/timer.cpp	Fri Nov 30 17:00:32 2012 -0800
+++ b/src/share/vm/runtime/timer.cpp	Fri Nov 30 11:46:17 2012 -0800
@@ -210,8 +210,9 @@
     } else {
       _logfile->print("[Error in TraceCPUTime]");
     }
-     if (_print_cr) {
+    if (_print_cr) {
       _logfile->print_cr("");
     }
+    _logfile->flush();
   }
 }