8184286: print_tracing_info() does not use Unified Logging for output

Reviewed-by: ehelin, sangheki
This commit is contained in:
Stefan Johansson 2017-09-21 14:32:05 +02:00
parent 2a93b38ee9
commit 52c73dd8a9
8 changed files with 31 additions and 43 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -574,16 +574,10 @@ void ParallelScavengeHeap::print_gc_threads_on(outputStream* st) const {
}
void ParallelScavengeHeap::print_tracing_info() const {
if (TraceYoungGenTime) {
double time = PSScavenge::accumulated_time()->seconds();
tty->print_cr("[Accumulated GC generation 0 time %3.7f secs]", time);
}
if (TraceOldGenTime) {
double time = UseParallelOldGC ? PSParallelCompact::accumulated_time()->seconds() : PSMarkSweep::accumulated_time()->seconds();
tty->print_cr("[Accumulated GC generation 1 time %3.7f secs]", time);
}
AdaptiveSizePolicyOutput::print();
log_debug(gc, heap, exit)("Accumulated young generation GC time %3.7f secs", PSScavenge::accumulated_time()->seconds());
log_debug(gc, heap, exit)("Accumulated old generation GC time %3.7f secs",
UseParallelOldGC ? PSParallelCompact::accumulated_time()->seconds() : PSMarkSweep::accumulated_time()->seconds());
}

View File

@ -173,7 +173,9 @@ bool PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) {
TraceCollectorStats tcs(counters());
TraceMemoryManagerStats tms(true /* Full GC */,gc_cause);
if (TraceOldGenTime) accumulated_time()->start();
if (log_is_enabled(Debug, gc, heap, exit)) {
accumulated_time()->start();
}
// Let the size policy know we're starting
size_policy->major_collection_begin();
@ -342,7 +344,9 @@ bool PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) {
// We collected the heap, recalculate the metaspace capacity
MetaspaceGC::compute_new_size();
if (TraceOldGenTime) accumulated_time()->stop();
if (log_is_enabled(Debug, gc, heap, exit)) {
accumulated_time()->stop();
}
young_gen->print_used_change(young_gen_prev_used);
old_gen->print_used_change(old_gen_prev_used);

View File

@ -1778,7 +1778,9 @@ bool PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) {
TraceCollectorStats tcs(counters());
TraceMemoryManagerStats tms(true /* Full GC */,gc_cause);
if (TraceOldGenTime) accumulated_time()->start();
if (log_is_enabled(Debug, gc, heap, exit)) {
accumulated_time()->start();
}
// Let the size policy know we're starting
size_policy->major_collection_begin();
@ -1897,7 +1899,7 @@ bool PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) {
// Resize the metaspace capacity after a collection
MetaspaceGC::compute_new_size();
if (TraceOldGenTime) {
if (log_is_enabled(Debug, gc, heap, exit)) {
accumulated_time()->stop();
}

View File

@ -306,7 +306,9 @@ bool PSScavenge::invoke_no_policy() {
TraceCollectorStats tcs(counters());
TraceMemoryManagerStats tms(false /* not full GC */,gc_cause);
if (TraceYoungGenTime) accumulated_time()->start();
if (log_is_enabled(Debug, gc, heap, exit)) {
accumulated_time()->start();
}
// Let the size policy know we're starting
size_policy->minor_collection_begin();
@ -607,7 +609,9 @@ bool PSScavenge::invoke_no_policy() {
CardTableExtension::verify_all_young_refs_imprecise();
}
if (TraceYoungGenTime) accumulated_time()->stop();
if (log_is_enabled(Debug, gc, heap, exit)) {
accumulated_time()->stop();
}
young_gen->print_used_change(pre_gc_values.young_gen_used());
old_gen->print_used_change(pre_gc_values.old_gen_used());

View File

@ -1157,11 +1157,10 @@ void GenCollectedHeap::print_on_error(outputStream* st) const {
}
void GenCollectedHeap::print_tracing_info() const {
if (TraceYoungGenTime) {
_young_gen->print_summary_info();
}
if (TraceOldGenTime) {
_old_gen->print_summary_info();
if (log_is_enabled(Debug, gc, heap, exit)) {
LogStreamHandle(Debug, gc, heap, exit) lsh;
_young_gen->print_summary_info_on(&lsh);
_old_gen->print_summary_info_on(&lsh);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -94,22 +94,14 @@ void Generation::print_on(outputStream* st) const {
p2i(_virtual_space.high_boundary()));
}
void Generation::print_summary_info() { print_summary_info_on(tty); }
void Generation::print_summary_info_on(outputStream* st) {
StatRecord* sr = stat_record();
double time = sr->accumulated_time.seconds();
// I didn't want to change the logging when removing the level concept,
// but I guess this logging could say young/old or something instead of 0/1.
uint level;
if (GenCollectedHeap::heap()->is_young_gen(this)) {
level = 0;
} else {
level = 1;
}
st->print_cr("[Accumulated GC generation %d time %3.7f secs, "
"%u GC's, avg GC time %3.7f]",
level, time, sr->invocations,
st->print_cr("Accumulated %s generation GC time %3.7f secs, "
"%u GC's, avg GC time %3.7f",
GenCollectedHeap::heap()->is_young_gen(this) ? "young" : "old" ,
time,
sr->invocations,
sr->invocations > 0 ? time / sr->invocations : 0.0);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -549,7 +549,6 @@ private:
public:
StatRecord* stat_record() { return &_stat_record; }
virtual void print_summary_info();
virtual void print_summary_info_on(outputStream* st);
// Performance Counter support

View File

@ -2344,12 +2344,6 @@ public:
range(30*K, max_uintx/BytesPerWord) \
constraint(InitialBootClassLoaderMetaspaceSizeConstraintFunc, AfterErgo)\
\
product(bool, TraceYoungGenTime, false, \
"Trace accumulated time for young collection") \
\
product(bool, TraceOldGenTime, false, \
"Trace accumulated time for old collection") \
\
product(bool, PrintHeapAtSIGBREAK, true, \
"Print heap layout in response to SIGBREAK") \
\