提交 510d088c 编写于 作者: T tonyp

6885041: G1: inconsistent thread dump

Summary: When G1 is enabled, thread dumps are inconsistent as the info for some of the G1 threads is not formatted properly.
Reviewed-by: ysr, johnc
上级 09bf8082
......@@ -377,3 +377,11 @@ void ConcurrentG1Refine::clear_and_record_card_counts() {
_g1h->g1_policy()->record_cc_clear_time(elapsed * 1000.0);
#endif
}
void ConcurrentG1Refine::print_worker_threads_on(outputStream* st) const {
for (int i = 0; i < _n_threads; ++i) {
_threads[i]->print_on(st);
st->cr();
}
}
......@@ -179,4 +179,6 @@ class ConcurrentG1Refine: public CHeapObj {
void clear_and_record_card_counts();
static size_t thread_num();
void print_worker_threads_on(outputStream* st) const;
};
......@@ -204,8 +204,12 @@ void ConcurrentG1RefineThread::stop() {
if (G1TraceConcurrentRefinement) gclog_or_tty->print_cr("G1-Refine-stop");
}
void ConcurrentG1RefineThread::print() {
gclog_or_tty->print("\"Concurrent G1 Refinement Thread\" ");
Thread::print();
gclog_or_tty->cr();
void ConcurrentG1RefineThread::print() const {
print_on(tty);
}
void ConcurrentG1RefineThread::print_on(outputStream* st) const {
st->print("\"G1 Concurrent Refinement Thread#%d\" ", _worker_id);
Thread::print_on(st);
st->cr();
}
......@@ -77,7 +77,8 @@ class ConcurrentG1RefineThread: public ConcurrentGCThread {
int worker_id_offset, int worker_id);
// Printing
void print();
void print() const;
void print_on(outputStream* st) const;
// Total virtual time so far.
double vtime_accum() { return _vtime_accum; }
......
......@@ -543,7 +543,7 @@ ConcurrentMark::ConcurrentMark(ReservedSpace rs,
#endif
guarantee( parallel_marking_threads() > 0, "peace of mind" );
_parallel_workers = new WorkGang("Parallel Marking Threads",
_parallel_workers = new WorkGang("G1 Parallel Marking Threads",
(int) parallel_marking_threads(), false, true);
if (_parallel_workers == NULL)
vm_exit_during_initialization("Failed necessary allocation.");
......@@ -2637,6 +2637,10 @@ void ConcurrentMark::print_summary_info() {
cmThread()->vtime_count_accum());
}
void ConcurrentMark::print_worker_threads_on(outputStream* st) const {
_parallel_workers->print_worker_threads_on(st);
}
// Closures
// XXX: there seems to be a lot of code duplication here;
// should refactor and consolidate the shared code.
......
......@@ -723,6 +723,8 @@ public:
void print_summary_info();
void print_worker_threads_on(outputStream* st) const;
// The following indicate whether a given verbose level has been
// set. Notice that anything above stats is conditional to
// _MARKING_VERBOSE_ having been set to 1
......
......@@ -286,10 +286,14 @@ void ConcurrentMarkThread::stop() {
}
}
void ConcurrentMarkThread::print() {
gclog_or_tty->print("\"Concurrent Mark GC Thread\" ");
Thread::print();
gclog_or_tty->cr();
void ConcurrentMarkThread::print() const {
print_on(tty);
}
void ConcurrentMarkThread::print_on(outputStream* st) const {
st->print("\"G1 Main Concurrent Mark GC Thread\" ");
Thread::print_on(st);
st->cr();
}
void ConcurrentMarkThread::sleepBeforeNextCycle() {
......
......@@ -57,7 +57,8 @@ class ConcurrentMarkThread: public ConcurrentGCThread {
static SurrogateLockerThread* slt() { return _slt; }
// Printing
void print();
void print_on(outputStream* st) const;
void print() const;
// Total virtual time so far.
double vtime_accum();
......
......@@ -157,10 +157,14 @@ void ConcurrentZFThread::stop() {
}
}
void ConcurrentZFThread::print() {
gclog_or_tty->print("\"Concurrent ZF Thread\" ");
Thread::print();
gclog_or_tty->cr();
void ConcurrentZFThread::print() const {
print_on(tty);
}
void ConcurrentZFThread::print_on(outputStream* st) const {
st->print("\"G1 Concurrent Zero-Fill Thread\" ");
Thread::print_on(st);
st->cr();
}
......
......@@ -61,7 +61,8 @@ class ConcurrentZFThread: public ConcurrentGCThread {
virtual void run();
// Printing
void print();
void print_on(outputStream* st) const;
void print() const;
// Waits until "r" has been zero-filled. Requires caller to hold the
// ZF_mon.
......
......@@ -2383,27 +2383,18 @@ void G1CollectedHeap::print_on_extended(outputStream* st) const {
_hrs->iterate(&blk);
}
class PrintOnThreadsClosure : public ThreadClosure {
outputStream* _st;
public:
PrintOnThreadsClosure(outputStream* st) : _st(st) { }
virtual void do_thread(Thread *t) {
t->print_on(_st);
}
};
void G1CollectedHeap::print_gc_threads_on(outputStream* st) const {
if (ParallelGCThreads > 0) {
workers()->print_worker_threads();
workers()->print_worker_threads_on(st);
}
st->print("\"G1 concurrent mark GC Thread\" ");
_cmThread->print();
st->cr();
st->print("\"G1 concurrent refinement GC Threads\" ");
PrintOnThreadsClosure p(st);
_cg1r->threads_do(&p);
_cmThread->print_on(st);
st->cr();
st->print("\"G1 zero-fill GC Thread\" ");
_cm->print_worker_threads_on(st);
_cg1r->print_worker_threads_on(st);
_czft->print_on(st);
st->cr();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册