8005672: Clean up some changes to GC logging with GCCause's
authorjmasa
Fri, 04 Jan 2013 17:04:46 -0800
changeset 15095 8ce5dcdbeb26
parent 15094 80724d2b6f25
child 15107 55cbde13be26
child 15111 50ab480cb8d6
8005672: Clean up some changes to GC logging with GCCause's Reviewed-by: johnc, ysr
hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp
hotspot/src/share/vm/gc_interface/gcCause.hpp
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Fri Jan 04 17:04:25 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Fri Jan 04 17:04:46 2013 -0800
@@ -827,10 +827,10 @@
   GenCollectedHeap* gch = GenCollectedHeap::heap();
   if (PrintGCDetails) {
     if (Verbose) {
-      gclog_or_tty->print(" [%d %s-%s: "SIZE_FORMAT"("SIZE_FORMAT")]",
+      gclog_or_tty->print("[%d %s-%s: "SIZE_FORMAT"("SIZE_FORMAT")]",
         level(), short_name(), s, used(), capacity());
     } else {
-      gclog_or_tty->print(" [%d %s-%s: "SIZE_FORMAT"K("SIZE_FORMAT"K)]",
+      gclog_or_tty->print("[%d %s-%s: "SIZE_FORMAT"K("SIZE_FORMAT"K)]",
         level(), short_name(), s, used() / K, capacity() / K);
     }
   }
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri Jan 04 17:04:25 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri Jan 04 17:04:46 2013 -0800
@@ -3668,7 +3668,7 @@
   gclog_or_tty->stamp(PrintGCTimeStamps);
 
   GCCauseString gc_cause_str = GCCauseString("GC pause", gc_cause())
-    .append(g1_policy()->gcs_are_young() ? " (young)" : " (mixed)")
+    .append(g1_policy()->gcs_are_young() ? "(young)" : "(mixed)")
     .append(g1_policy()->during_initial_mark_pause() ? " (initial-mark)" : "");
 
   gclog_or_tty->print("[%s", (const char*)gc_cause_str);
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp	Fri Jan 04 17:04:25 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp	Fri Jan 04 17:04:46 2013 -0800
@@ -808,8 +808,9 @@
   st->print("  to  "); to_space()->print_on(st);
 }
 
+// Note that a space is not printed before the [NAME:
 void PSYoungGen::print_used_change(size_t prev_used) const {
-  gclog_or_tty->print(" [%s:", name());
+  gclog_or_tty->print("[%s:", name());
   gclog_or_tty->print(" "  SIZE_FORMAT "K"
                       "->" SIZE_FORMAT "K"
                       "("  SIZE_FORMAT "K)",
--- a/hotspot/src/share/vm/gc_interface/gcCause.hpp	Fri Jan 04 17:04:25 2013 -0800
+++ b/hotspot/src/share/vm/gc_interface/gcCause.hpp	Fri Jan 04 17:04:46 2013 -0800
@@ -99,9 +99,9 @@
  public:
    GCCauseString(const char* prefix, GCCause::Cause cause) {
      if (PrintGCCause) {
-      _position = jio_snprintf(_buffer, _length, "%s (%s)", prefix, GCCause::to_string(cause));
+      _position = jio_snprintf(_buffer, _length, "%s (%s) ", prefix, GCCause::to_string(cause));
      } else {
-      _position = jio_snprintf(_buffer, _length, "%s", prefix);
+      _position = jio_snprintf(_buffer, _length, "%s ", prefix);
      }
      assert(_position >= 0 && _position <= _length,
        err_msg("Need to increase the buffer size in GCCauseString? %d", _position));