6885993: Named Thread: introduce print() and print_on(outputStream* st) methods
Eliminating duplicated code by introducing print_on(outputStream* st) methods in NamedThread Reviewed-by: twisti, coleenp, dholmes
This commit is contained in:
parent
a792009a9f
commit
16a3e2f16d
@ -223,12 +223,6 @@ void ConcurrentMarkSweepThread::threads_do(ThreadClosure* tc) {
|
||||
}
|
||||
}
|
||||
|
||||
void ConcurrentMarkSweepThread::print_on(outputStream* st) const {
|
||||
st->print("\"%s\" ", name());
|
||||
Thread::print_on(st);
|
||||
st->cr();
|
||||
}
|
||||
|
||||
void ConcurrentMarkSweepThread::print_all_on(outputStream* st) {
|
||||
if (_cmst != NULL) {
|
||||
_cmst->print_on(st);
|
||||
|
@ -94,8 +94,6 @@ class ConcurrentMarkSweepThread: public ConcurrentGCThread {
|
||||
static void threads_do(ThreadClosure* tc);
|
||||
|
||||
// Printing
|
||||
void print_on(outputStream* st) const;
|
||||
void print() const { print_on(tty); }
|
||||
static void print_all_on(outputStream* st);
|
||||
static void print_all() { print_all_on(tty); }
|
||||
|
||||
|
@ -58,6 +58,9 @@ ConcurrentG1RefineThread(ConcurrentG1Refine* cg1r, ConcurrentG1RefineThread *nex
|
||||
}
|
||||
initialize();
|
||||
create_and_start();
|
||||
|
||||
// set name
|
||||
set_name("G1 Concurrent Refinement Thread#%d", worker_id);
|
||||
}
|
||||
|
||||
void ConcurrentG1RefineThread::initialize() {
|
||||
@ -247,12 +250,3 @@ void ConcurrentG1RefineThread::stop() {
|
||||
}
|
||||
}
|
||||
|
||||
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,10 +77,6 @@ public:
|
||||
|
||||
void initialize();
|
||||
|
||||
// Printing
|
||||
void print() const;
|
||||
void print_on(outputStream* st) const;
|
||||
|
||||
// Total virtual time so far.
|
||||
double vtime_accum() { return _vtime_accum; }
|
||||
|
||||
|
@ -46,6 +46,8 @@ ConcurrentMarkThread::ConcurrentMarkThread(ConcurrentMark* cm) :
|
||||
_in_progress(false),
|
||||
_vtime_accum(0.0),
|
||||
_vtime_mark_accum(0.0) {
|
||||
|
||||
set_name("G1 Main Concurrent Mark GC Thread");
|
||||
create_and_start();
|
||||
}
|
||||
|
||||
@ -322,16 +324,6 @@ void ConcurrentMarkThread::stop() {
|
||||
}
|
||||
}
|
||||
|
||||
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() {
|
||||
// We join here because we don't want to do the "shouldConcurrentMark()"
|
||||
// below while the world is otherwise stopped.
|
||||
|
@ -60,10 +60,6 @@ class ConcurrentMarkThread: public ConcurrentGCThread {
|
||||
static void makeSurrogateLockerThread(TRAPS);
|
||||
static SurrogateLockerThread* slt() { return _slt; }
|
||||
|
||||
// Printing
|
||||
void print_on(outputStream* st) const;
|
||||
void print() const;
|
||||
|
||||
// Total virtual time so far.
|
||||
double vtime_accum();
|
||||
// Marking virtual time so far
|
||||
|
@ -53,12 +53,6 @@ G1StringDedupThread* G1StringDedupThread::thread() {
|
||||
return _thread;
|
||||
}
|
||||
|
||||
void G1StringDedupThread::print_on(outputStream* st) const {
|
||||
st->print("\"%s\" ", name());
|
||||
Thread::print_on(st);
|
||||
st->cr();
|
||||
}
|
||||
|
||||
void G1StringDedupThread::run() {
|
||||
G1StringDedupStat total_stat;
|
||||
|
||||
|
@ -52,7 +52,6 @@ public:
|
||||
static G1StringDedupThread* thread();
|
||||
|
||||
virtual void run();
|
||||
virtual void print_on(outputStream* st) const;
|
||||
};
|
||||
|
||||
#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1STRINGDEDUPTHREAD_HPP
|
||||
|
@ -87,12 +87,6 @@ void GCTaskThread::print_task_time_stamps() {
|
||||
_time_stamp_index = 0;
|
||||
}
|
||||
|
||||
void GCTaskThread::print_on(outputStream* st) const {
|
||||
st->print("\"%s\" ", name());
|
||||
Thread::print_on(st);
|
||||
st->cr();
|
||||
}
|
||||
|
||||
// GC workers get tasks from the GCTaskManager and execute
|
||||
// them in this method. If there are no tasks to execute,
|
||||
// the GC workers wait in the GCTaskManager's get_task()
|
||||
|
@ -69,8 +69,6 @@ private:
|
||||
void start();
|
||||
|
||||
void print_task_time_stamps();
|
||||
void print_on(outputStream* st) const;
|
||||
void print() const { print_on(tty); }
|
||||
|
||||
protected:
|
||||
// Constructor. Clients use factory, but there could be subclasses.
|
||||
|
@ -1198,6 +1198,13 @@ void NamedThread::set_name(const char* format, ...) {
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void NamedThread::print_on(outputStream* st) const {
|
||||
st->print("\"%s\" ", name());
|
||||
Thread::print_on(st);
|
||||
st->cr();
|
||||
}
|
||||
|
||||
|
||||
// ======= WatcherThread ========
|
||||
|
||||
// The watcher thread exists to simulate timer interrupts. It should
|
||||
|
@ -566,7 +566,7 @@ public:
|
||||
void set_lgrp_id(int value) { _lgrp_id = value; }
|
||||
|
||||
// Printing
|
||||
void print_on(outputStream* st) const;
|
||||
virtual void print_on(outputStream* st) const;
|
||||
void print() const { print_on(tty); }
|
||||
virtual void print_on_error(outputStream* st, char* buf, int buflen) const;
|
||||
|
||||
@ -700,6 +700,7 @@ class NamedThread: public Thread {
|
||||
virtual char* name() const { return _name == NULL ? (char*)"Unknown Thread" : _name; }
|
||||
JavaThread *processed_thread() { return _processed_thread; }
|
||||
void set_processed_thread(JavaThread *thread) { _processed_thread = thread; }
|
||||
virtual void print_on(outputStream* st) const;
|
||||
};
|
||||
|
||||
// Worker threads are named and have an id of an assigned work.
|
||||
@ -746,7 +747,6 @@ class WatcherThread: public Thread {
|
||||
// Printing
|
||||
char* name() const { return (char*)"VM Periodic Task Thread"; }
|
||||
void print_on(outputStream* st) const;
|
||||
void print() const { print_on(tty); }
|
||||
void unpark();
|
||||
|
||||
// Returns the single instance of WatcherThread
|
||||
@ -1459,7 +1459,6 @@ class JavaThread: public Thread {
|
||||
// Misc. operations
|
||||
char* name() const { return (char*)get_thread_name(); }
|
||||
void print_on(outputStream* st) const;
|
||||
void print() const { print_on(tty); }
|
||||
void print_value();
|
||||
void print_thread_state_on(outputStream* ) const PRODUCT_RETURN;
|
||||
void print_thread_state() const PRODUCT_RETURN;
|
||||
|
@ -339,12 +339,6 @@ void VMThread::wait_for_vm_thread_exit() {
|
||||
}
|
||||
}
|
||||
|
||||
void VMThread::print_on(outputStream* st) const {
|
||||
st->print("\"%s\" ", name());
|
||||
Thread::print_on(st);
|
||||
st->cr();
|
||||
}
|
||||
|
||||
void VMThread::evaluate_operation(VM_Operation* op) {
|
||||
ResourceMark rm;
|
||||
|
||||
|
@ -128,9 +128,6 @@ class VMThread: public NamedThread {
|
||||
// GC support
|
||||
void oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf);
|
||||
|
||||
// Debugging
|
||||
void print_on(outputStream* st) const;
|
||||
void print() const { print_on(tty); }
|
||||
void verify();
|
||||
|
||||
// Performance measurement
|
||||
|
Loading…
x
Reference in New Issue
Block a user