8153187: Convert TraceWorkGang to use unified logging
Reviewed-by: mgerdin, tschatzl
--- a/hotspot/src/share/vm/gc/shared/workgroup.cpp Fri Apr 01 07:08:30 2016 +0200
+++ b/hotspot/src/share/vm/gc/shared/workgroup.cpp Fri Apr 01 07:08:40 2016 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, 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
@@ -40,12 +40,7 @@
// initialization of the workers and report such to the
// caller.
bool AbstractWorkGang::initialize_workers() {
-
- if (TraceWorkGang) {
- tty->print_cr("Constructing work gang %s with %d threads",
- name(),
- total_workers());
- }
+ log_develop_trace(gc, workgang)("Constructing work gang %s with %u threads", name(), total_workers());
_workers = NEW_C_HEAP_ARRAY(AbstractGangWorker*, total_workers(), mtInternal);
if (_workers == NULL) {
vm_exit_out_of_memory(0, OOM_MALLOC_ERROR, "Cannot create GangWorker array.");
@@ -279,10 +274,7 @@
this->initialize_named_thread();
assert(_gang != NULL, "No gang to run in");
os::set_priority(this, NearMaxPriority);
- if (TraceWorkGang) {
- tty->print_cr("Running gang worker for gang %s id %u",
- gang()->name(), id());
- }
+ log_develop_trace(gc, workgang)("Running gang worker for gang %s id %u", gang()->name(), id());
// The VM thread should not execute here because MutexLocker's are used
// as (opposed to MutexLockerEx's).
assert(!Thread::current()->is_VM_thread(), "VM thread should not be part"
@@ -311,27 +303,14 @@
gang()->dispatcher()->worker_done_with_task();
}
-void GangWorker::print_task_started(WorkData data) {
- if (TraceWorkGang) {
- tty->print_cr("Running work gang %s task %s worker %u", name(), data._task->name(), data._worker_id);
- }
-}
+void GangWorker::run_task(WorkData data) {
+ GCIdMark gc_id_mark(data._task->gc_id());
+ log_develop_trace(gc, workgang)("Running work gang: %s task: %s worker: %u", name(), data._task->name(), data._worker_id);
-void GangWorker::print_task_done(WorkData data) {
- if (TraceWorkGang) {
- tty->print_cr("\nFinished work gang %s task %s worker %u", name(), data._task->name(), data._worker_id);
- Thread* me = Thread::current();
- tty->print_cr(" T: " PTR_FORMAT " VM_thread: %d", p2i(me), me->is_VM_thread());
- }
-}
-
-void GangWorker::run_task(WorkData data) {
- print_task_started(data);
-
- GCIdMark gc_id_mark(data._task->gc_id());
data._task->work(data._worker_id);
- print_task_done(data);
+ log_develop_trace(gc, workgang)("Finished work gang: %s task: %s worker: %u thread: " PTR_FORMAT,
+ name(), data._task->name(), data._worker_id, p2i(Thread::current()));
}
void GangWorker::loop() {
--- a/hotspot/src/share/vm/gc/shared/workgroup.hpp Fri Apr 01 07:08:30 2016 +0200
+++ b/hotspot/src/share/vm/gc/shared/workgroup.hpp Fri Apr 01 07:08:40 2016 +0200
@@ -234,9 +234,6 @@
void run_task(WorkData work);
void signal_task_done();
- void print_task_started(WorkData data);
- void print_task_done(WorkData data);
-
WorkGang* gang() const { return (WorkGang*)_gang; }
};
--- a/hotspot/src/share/vm/logging/logPrefix.hpp Fri Apr 01 07:08:30 2016 +0200
+++ b/hotspot/src/share/vm/logging/logPrefix.hpp Fri Apr 01 07:08:40 2016 +0200
@@ -77,7 +77,8 @@
LOG_PREFIX(GCId::print_prefix, LOG_TAGS(gc, task, stats)) \
LOG_PREFIX(GCId::print_prefix, LOG_TAGS(gc, task, time)) \
DEBUG_ONLY(LOG_PREFIX(Test_log_prefix_prefixer, LOG_TAGS(logging, test))) \
- LOG_PREFIX(GCId::print_prefix, LOG_TAGS(gc, tlab))
+ LOG_PREFIX(GCId::print_prefix, LOG_TAGS(gc, tlab)) \
+ LOG_PREFIX(GCId::print_prefix, LOG_TAGS(gc, workgang))
// The empty prefix, used when there's no prefix defined.
--- a/hotspot/src/share/vm/logging/logTag.hpp Fri Apr 01 07:08:30 2016 +0200
+++ b/hotspot/src/share/vm/logging/logTag.hpp Fri Apr 01 07:08:40 2016 +0200
@@ -100,6 +100,7 @@
LOG_TAG(verify) \
LOG_TAG(vmoperation) \
LOG_TAG(vtables) \
+ LOG_TAG(workgang) \
LOG_TAG_LIST_EXT
#define PREFIX_LOG_TAG(T) (LogTag::_##T)
--- a/hotspot/src/share/vm/runtime/globals.hpp Fri Apr 01 07:08:30 2016 +0200
+++ b/hotspot/src/share/vm/runtime/globals.hpp Fri Apr 01 07:08:40 2016 +0200
@@ -2402,9 +2402,6 @@
manageable(bool, PrintClassHistogram, false, \
"Print a histogram of class instances") \
\
- develop(bool, TraceWorkGang, false, \
- "Trace activities of work gangs") \
- \
develop(bool, TraceGCTaskManager, false, \
"Trace actions of the GC task manager") \
\