提交 586a7855 编写于 作者: J jmasa

8005672: Clean up some changes to GC logging with GCCause's

Reviewed-by: johnc, ysr
上级 beabdf1c
...@@ -827,10 +827,10 @@ void ConcurrentMarkSweepGeneration::printOccupancy(const char *s) { ...@@ -827,10 +827,10 @@ void ConcurrentMarkSweepGeneration::printOccupancy(const char *s) {
GenCollectedHeap* gch = GenCollectedHeap::heap(); GenCollectedHeap* gch = GenCollectedHeap::heap();
if (PrintGCDetails) { if (PrintGCDetails) {
if (Verbose) { 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()); level(), short_name(), s, used(), capacity());
} else { } 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); level(), short_name(), s, used() / K, capacity() / K);
} }
} }
......
...@@ -3668,7 +3668,7 @@ void G1CollectedHeap::log_gc_header() { ...@@ -3668,7 +3668,7 @@ void G1CollectedHeap::log_gc_header() {
gclog_or_tty->stamp(PrintGCTimeStamps); gclog_or_tty->stamp(PrintGCTimeStamps);
GCCauseString gc_cause_str = GCCauseString("GC pause", gc_cause()) 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)" : ""); .append(g1_policy()->during_initial_mark_pause() ? " (initial-mark)" : "");
gclog_or_tty->print("[%s", (const char*)gc_cause_str); gclog_or_tty->print("[%s", (const char*)gc_cause_str);
......
...@@ -808,8 +808,9 @@ void PSYoungGen::print_on(outputStream* st) const { ...@@ -808,8 +808,9 @@ void PSYoungGen::print_on(outputStream* st) const {
st->print(" to "); to_space()->print_on(st); 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 { 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" gclog_or_tty->print(" " SIZE_FORMAT "K"
"->" SIZE_FORMAT "K" "->" SIZE_FORMAT "K"
"(" SIZE_FORMAT "K)", "(" SIZE_FORMAT "K)",
......
...@@ -99,9 +99,9 @@ class GCCauseString : StackObj { ...@@ -99,9 +99,9 @@ class GCCauseString : StackObj {
public: public:
GCCauseString(const char* prefix, GCCause::Cause cause) { GCCauseString(const char* prefix, GCCause::Cause cause) {
if (PrintGCCause) { 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 { } else {
_position = jio_snprintf(_buffer, _length, "%s", prefix); _position = jio_snprintf(_buffer, _length, "%s ", prefix);
} }
assert(_position >= 0 && _position <= _length, assert(_position >= 0 && _position <= _length,
err_msg("Need to increase the buffer size in GCCauseString? %d", _position)); err_msg("Need to increase the buffer size in GCCauseString? %d", _position));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册