提交 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, ...@@ -3006,7 +3006,10 @@ void G1CollectedHeap::verify(bool allow_dirty,
if (failures) { if (failures) {
gclog_or_tty->print_cr("Heap:"); 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(""); gclog_or_tty->print_cr("");
#ifndef PRODUCT #ifndef PRODUCT
if (VerifyDuringGC && G1VerifyDuringGCPrintReachable) { if (VerifyDuringGC && G1VerifyDuringGCPrintReachable) {
...@@ -3032,13 +3035,7 @@ public: ...@@ -3032,13 +3035,7 @@ public:
} }
}; };
void G1CollectedHeap::print() const { print_on(tty); }
void G1CollectedHeap::print_on(outputStream* st) const { 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(" %-20s", "garbage-first heap");
st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K", st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K",
capacity()/K, used_unlocked()/K); capacity()/K, used_unlocked()/K);
...@@ -3056,13 +3053,14 @@ void G1CollectedHeap::print_on(outputStream* st, bool extended) const { ...@@ -3056,13 +3053,14 @@ void G1CollectedHeap::print_on(outputStream* st, bool extended) const {
survivor_regions, survivor_regions * HeapRegion::GrainBytes / K); survivor_regions, survivor_regions * HeapRegion::GrainBytes / K);
st->cr(); st->cr();
perm()->as_gen()->print_on(st); 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); PrintRegionClosure blk(st);
heap_region_iterate(&blk); heap_region_iterate(&blk);
} }
......
...@@ -1449,14 +1449,8 @@ public: ...@@ -1449,14 +1449,8 @@ public:
// Override; it uses the "prev" marking information // Override; it uses the "prev" marking information
virtual void verify(bool allow_dirty, bool silent); 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; virtual void print_on(outputStream* st) const;
// If extended is true, it will print out information for all virtual void print_extended_on(outputStream* st) const;
// 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_gc_threads_on(outputStream* st) const; virtual void print_gc_threads_on(outputStream* st) const;
virtual void gc_threads_do(ThreadClosure* tc) const; virtual void gc_threads_do(ThreadClosure* tc) const;
......
...@@ -722,7 +722,7 @@ void HeapRegion::print_on(outputStream* st) const { ...@@ -722,7 +722,7 @@ void HeapRegion::print_on(outputStream* st) const {
st->print(" F"); st->print(" F");
else else
st->print(" "); st->print(" ");
st->print(" %5d", _gc_time_stamp); st->print(" TS %5d", _gc_time_stamp);
st->print(" PTAMS "PTR_FORMAT" NTAMS "PTR_FORMAT, st->print(" PTAMS "PTR_FORMAT" NTAMS "PTR_FORMAT,
prev_top_at_mark_start(), next_top_at_mark_start()); prev_top_at_mark_start(), next_top_at_mark_start());
G1OffsetTableContigSpace::print_on(st); G1OffsetTableContigSpace::print_on(st);
......
...@@ -863,8 +863,6 @@ void ParallelScavengeHeap::prepare_for_verify() { ...@@ -863,8 +863,6 @@ void ParallelScavengeHeap::prepare_for_verify() {
ensure_parsability(false); // no need to retire TLABs for verification ensure_parsability(false); // no need to retire TLABs for verification
} }
void ParallelScavengeHeap::print() const { print_on(tty); }
void ParallelScavengeHeap::print_on(outputStream* st) const { void ParallelScavengeHeap::print_on(outputStream* st) const {
young_gen()->print_on(st); young_gen()->print_on(st);
old_gen()->print_on(st); old_gen()->print_on(st);
......
...@@ -246,8 +246,7 @@ CollectorPolicy* collector_policy() const { return (CollectorPolicy*) _collector ...@@ -246,8 +246,7 @@ CollectorPolicy* collector_policy() const { return (CollectorPolicy*) _collector
jlong millis_since_last_gc(); jlong millis_since_last_gc();
void prepare_for_verify(); void prepare_for_verify();
void print() const; virtual void print_on(outputStream* st) const;
void print_on(outputStream* st) const;
virtual void print_gc_threads_on(outputStream* st) const; virtual void print_gc_threads_on(outputStream* st) const;
virtual void gc_threads_do(ThreadClosure* tc) const; virtual void gc_threads_do(ThreadClosure* tc) const;
virtual void print_tracing_info() const; virtual void print_tracing_info() const;
......
...@@ -590,13 +590,27 @@ class CollectedHeap : public CHeapObj { ...@@ -590,13 +590,27 @@ class CollectedHeap : public CHeapObj {
void pre_full_gc_dump(); void pre_full_gc_dump();
void post_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; 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) // Print all GC threads (other than the VM thread)
// used by this heap. // used by this heap.
virtual void print_gc_threads_on(outputStream* st) const = 0; 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) // Iterator for all GC threads (other than VM thread)
virtual void gc_threads_do(ThreadClosure* tc) const = 0; virtual void gc_threads_do(ThreadClosure* tc) const = 0;
......
...@@ -1270,7 +1270,6 @@ void GenCollectedHeap::verify(bool allow_dirty, bool silent, VerifyOption option ...@@ -1270,7 +1270,6 @@ void GenCollectedHeap::verify(bool allow_dirty, bool silent, VerifyOption option
rem_set()->verify(); rem_set()->verify();
} }
void GenCollectedHeap::print() const { print_on(tty); }
void GenCollectedHeap::print_on(outputStream* st) const { void GenCollectedHeap::print_on(outputStream* st) const {
for (int i = 0; i < _n_gens; i++) { for (int i = 0; i < _n_gens; i++) {
_gens[i]->print_on(st); _gens[i]->print_on(st);
......
...@@ -360,8 +360,7 @@ public: ...@@ -360,8 +360,7 @@ public:
void verify(bool allow_dirty, bool silent, VerifyOption option); void verify(bool allow_dirty, bool silent, VerifyOption option);
// Override. // Override.
void print() const; virtual void print_on(outputStream* st) const;
void print_on(outputStream* st) const;
virtual void print_gc_threads_on(outputStream* st) const; virtual void print_gc_threads_on(outputStream* st) const;
virtual void gc_threads_do(ThreadClosure* tc) const; virtual void gc_threads_do(ThreadClosure* tc) const;
virtual void print_tracing_info() const; virtual void print_tracing_info() const;
......
...@@ -1281,11 +1281,17 @@ void Universe::flush_dependents_on_method(methodHandle m_h) { ...@@ -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"); st->print_cr("Heap");
if (!extended) {
heap()->print_on(st); heap()->print_on(st);
} else {
heap()->print_extended_on(st);
}
} }
void Universe::print_heap_at_SIGBREAK() { void Universe::print_heap_at_SIGBREAK() {
...@@ -1301,14 +1307,22 @@ void Universe::print_heap_before_gc(outputStream* st) { ...@@ -1301,14 +1307,22 @@ void Universe::print_heap_before_gc(outputStream* st) {
st->print_cr("{Heap before GC invocations=%u (full %u):", st->print_cr("{Heap before GC invocations=%u (full %u):",
heap()->total_collections(), heap()->total_collections(),
heap()->total_full_collections()); heap()->total_full_collections());
if (!PrintHeapAtGCExtended) {
heap()->print_on(st); heap()->print_on(st);
} else {
heap()->print_extended_on(st);
}
} }
void Universe::print_heap_after_gc(outputStream* st) { void Universe::print_heap_after_gc(outputStream* st) {
st->print_cr("Heap after GC invocations=%u (full %u):", st->print_cr("Heap after GC invocations=%u (full %u):",
heap()->total_collections(), heap()->total_collections(),
heap()->total_full_collections()); heap()->total_full_collections());
if (!PrintHeapAtGCExtended) {
heap()->print_on(st); heap()->print_on(st);
} else {
heap()->print_extended_on(st);
}
st->print_cr("}"); st->print_cr("}");
} }
......
...@@ -415,8 +415,12 @@ class Universe: AllStatic { ...@@ -415,8 +415,12 @@ class Universe: AllStatic {
static void verify(bool allow_dirty = true, bool silent = false, static void verify(bool allow_dirty = true, bool silent = false,
VerifyOption option = VerifyOption_Default ); VerifyOption option = VerifyOption_Default );
static int verify_count() { return _verify_count; } 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();
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_at_SIGBREAK();
static void print_heap_before_gc() { print_heap_before_gc(gclog_or_tty); } 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); } static void print_heap_after_gc() { print_heap_after_gc(gclog_or_tty); }
......
...@@ -680,8 +680,10 @@ void VMError::report(outputStream* st) { ...@@ -680,8 +680,10 @@ void VMError::report(outputStream* st) {
STEP(190, "(printing heap information)" ) STEP(190, "(printing heap information)" )
if (_verbose && Universe::is_fully_initialized()) { if (_verbose && Universe::is_fully_initialized()) {
// print heap information before vm abort // Print heap information before vm abort. As we'd like as much
Universe::print_on(st); // information as possible in the report we ask for the
// extended (i.e., more detailed) version.
Universe::print_on(st, true /* extended */);
st->cr(); st->cr();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册