提交 0579e53a 编写于 作者: T tonyp

7099849: G1: include heap region information in hs_err files

Reviewed-by: johnc, brutisso, poonam
上级 7c132dd4
......@@ -3006,7 +3006,10 @@ void G1CollectedHeap::verify(bool allow_dirty,
if (failures) {
gclog_or_tty->print_cr("Heap:");
print_on(gclog_or_tty, true /* extended */);
// It helps to have the per-region information in the output to
// help us track down what went wrong. This is why we call
// print_extended_on() instead of print_on().
print_extended_on(gclog_or_tty);
gclog_or_tty->print_cr("");
#ifndef PRODUCT
if (VerifyDuringGC && G1VerifyDuringGCPrintReachable) {
......@@ -3032,13 +3035,7 @@ public:
}
};
void G1CollectedHeap::print() const { print_on(tty); }
void G1CollectedHeap::print_on(outputStream* st) const {
print_on(st, PrintHeapAtGCExtended);
}
void G1CollectedHeap::print_on(outputStream* st, bool extended) const {
st->print(" %-20s", "garbage-first heap");
st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K",
capacity()/K, used_unlocked()/K);
......@@ -3056,13 +3053,14 @@ void G1CollectedHeap::print_on(outputStream* st, bool extended) const {
survivor_regions, survivor_regions * HeapRegion::GrainBytes / K);
st->cr();
perm()->as_gen()->print_on(st);
if (extended) {
st->cr();
print_on_extended(st);
}
}
void G1CollectedHeap::print_on_extended(outputStream* st) const {
void G1CollectedHeap::print_extended_on(outputStream* st) const {
print_on(st);
// Print the per-region information.
st->cr();
st->print_cr("Heap Regions: (Y=young(eden), SU=young(survivor), HS=humongous(starts), HC=humongous(continues), CS=collection set, F=free, TS=gc time stamp, PTAMS=previous top-at-mark-start, NTAMS=next top-at-mark-start)");
PrintRegionClosure blk(st);
heap_region_iterate(&blk);
}
......
......@@ -1449,14 +1449,8 @@ public:
// Override; it uses the "prev" marking information
virtual void verify(bool allow_dirty, bool silent);
// Default behavior by calling print(tty);
virtual void print() const;
// This calls print_on(st, PrintHeapAtGCExtended).
virtual void print_on(outputStream* st) const;
// If extended is true, it will print out information for all
// regions in the heap by calling print_on_extended(st).
virtual void print_on(outputStream* st, bool extended) const;
virtual void print_on_extended(outputStream* st) const;
virtual void print_extended_on(outputStream* st) const;
virtual void print_gc_threads_on(outputStream* st) const;
virtual void gc_threads_do(ThreadClosure* tc) const;
......
......@@ -722,7 +722,7 @@ void HeapRegion::print_on(outputStream* st) const {
st->print(" F");
else
st->print(" ");
st->print(" %5d", _gc_time_stamp);
st->print(" TS %5d", _gc_time_stamp);
st->print(" PTAMS "PTR_FORMAT" NTAMS "PTR_FORMAT,
prev_top_at_mark_start(), next_top_at_mark_start());
G1OffsetTableContigSpace::print_on(st);
......
......@@ -863,8 +863,6 @@ void ParallelScavengeHeap::prepare_for_verify() {
ensure_parsability(false); // no need to retire TLABs for verification
}
void ParallelScavengeHeap::print() const { print_on(tty); }
void ParallelScavengeHeap::print_on(outputStream* st) const {
young_gen()->print_on(st);
old_gen()->print_on(st);
......
......@@ -246,8 +246,7 @@ CollectorPolicy* collector_policy() const { return (CollectorPolicy*) _collector
jlong millis_since_last_gc();
void prepare_for_verify();
void print() const;
void print_on(outputStream* st) const;
virtual void print_on(outputStream* st) const;
virtual void print_gc_threads_on(outputStream* st) const;
virtual void gc_threads_do(ThreadClosure* tc) const;
virtual void print_tracing_info() const;
......
......@@ -590,13 +590,27 @@ class CollectedHeap : public CHeapObj {
void pre_full_gc_dump();
void post_full_gc_dump();
virtual void print() const = 0;
// Print heap information on the given outputStream.
virtual void print_on(outputStream* st) const = 0;
// The default behavior is to call print_on() on tty.
virtual void print() const {
print_on(tty);
}
// Print more detailed heap information on the given
// outputStream. The default behaviour is to call print_on(). It is
// up to each subclass to override it and add any additional output
// it needs.
virtual void print_extended_on(outputStream* st) const {
print_on(st);
}
// Print all GC threads (other than the VM thread)
// used by this heap.
virtual void print_gc_threads_on(outputStream* st) const = 0;
void print_gc_threads() { print_gc_threads_on(tty); }
// The default behavior is to call print_gc_threads_on() on tty.
void print_gc_threads() {
print_gc_threads_on(tty);
}
// Iterator for all GC threads (other than VM thread)
virtual void gc_threads_do(ThreadClosure* tc) const = 0;
......
......@@ -1270,7 +1270,6 @@ void GenCollectedHeap::verify(bool allow_dirty, bool silent, VerifyOption option
rem_set()->verify();
}
void GenCollectedHeap::print() const { print_on(tty); }
void GenCollectedHeap::print_on(outputStream* st) const {
for (int i = 0; i < _n_gens; i++) {
_gens[i]->print_on(st);
......
......@@ -360,8 +360,7 @@ public:
void verify(bool allow_dirty, bool silent, VerifyOption option);
// Override.
void print() const;
void print_on(outputStream* st) const;
virtual void print_on(outputStream* st) const;
virtual void print_gc_threads_on(outputStream* st) const;
virtual void gc_threads_do(ThreadClosure* tc) const;
virtual void print_tracing_info() const;
......
......@@ -1281,11 +1281,17 @@ void Universe::flush_dependents_on_method(methodHandle m_h) {
}
}
void Universe::print() { print_on(gclog_or_tty); }
void Universe::print() {
print_on(gclog_or_tty);
}
void Universe::print_on(outputStream* st) {
void Universe::print_on(outputStream* st, bool extended) {
st->print_cr("Heap");
if (!extended) {
heap()->print_on(st);
} else {
heap()->print_extended_on(st);
}
}
void Universe::print_heap_at_SIGBREAK() {
......@@ -1301,14 +1307,22 @@ void Universe::print_heap_before_gc(outputStream* st) {
st->print_cr("{Heap before GC invocations=%u (full %u):",
heap()->total_collections(),
heap()->total_full_collections());
if (!PrintHeapAtGCExtended) {
heap()->print_on(st);
} else {
heap()->print_extended_on(st);
}
}
void Universe::print_heap_after_gc(outputStream* st) {
st->print_cr("Heap after GC invocations=%u (full %u):",
heap()->total_collections(),
heap()->total_full_collections());
if (!PrintHeapAtGCExtended) {
heap()->print_on(st);
} else {
heap()->print_extended_on(st);
}
st->print_cr("}");
}
......
......@@ -415,8 +415,12 @@ class Universe: AllStatic {
static void verify(bool allow_dirty = true, bool silent = false,
VerifyOption option = VerifyOption_Default );
static int verify_count() { return _verify_count; }
// The default behavior is to call print_on() on gclog_or_tty.
static void print();
static void print_on(outputStream* st);
// The extended parameter determines which method on the heap will
// be called: print_on() (extended == false) or print_extended_on()
// (extended == true).
static void print_on(outputStream* st, bool extended = false);
static void print_heap_at_SIGBREAK();
static void print_heap_before_gc() { print_heap_before_gc(gclog_or_tty); }
static void print_heap_after_gc() { print_heap_after_gc(gclog_or_tty); }
......
......@@ -680,8 +680,10 @@ void VMError::report(outputStream* st) {
STEP(190, "(printing heap information)" )
if (_verbose && Universe::is_fully_initialized()) {
// print heap information before vm abort
Universe::print_on(st);
// Print heap information before vm abort. As we'd like as much
// information as possible in the report we ask for the
// extended (i.e., more detailed) version.
Universe::print_on(st, true /* extended */);
st->cr();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册