From 586a7855a6e90c249dc350e7d503a69747509ee1 Mon Sep 17 00:00:00 2001 From: jmasa Date: Fri, 4 Jan 2013 17:04:46 -0800 Subject: [PATCH] 8005672: Clean up some changes to GC logging with GCCause's Reviewed-by: johnc, ysr --- .../concurrentMarkSweep/concurrentMarkSweepGeneration.cpp | 4 ++-- src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp | 2 +- .../vm/gc_implementation/parallelScavenge/psYoungGen.cpp | 3 ++- src/share/vm/gc_interface/gcCause.hpp | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp index 475f2b8fe..25b936fd8 100644 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @@ -827,10 +827,10 @@ void ConcurrentMarkSweepGeneration::printOccupancy(const char *s) { 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); } } diff --git a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 448c57077..cc11754c9 100644 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -3668,7 +3668,7 @@ void G1CollectedHeap::log_gc_header() { 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); diff --git a/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp b/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp index 70c071dfe..2d8697587 100644 --- a/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp +++ b/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp @@ -808,8 +808,9 @@ void PSYoungGen::print_on(outputStream* st) const { 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)", diff --git a/src/share/vm/gc_interface/gcCause.hpp b/src/share/vm/gc_interface/gcCause.hpp index c9bfe106c..58abc2e6f 100644 --- a/src/share/vm/gc_interface/gcCause.hpp +++ b/src/share/vm/gc_interface/gcCause.hpp @@ -99,9 +99,9 @@ class GCCauseString : StackObj { 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)); -- GitLab