mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8145092: Use Unified Logging for the GC logging
JEP-271. VM changes contributed by brutisso, test changes contributed by david. Co-authored-by: David Lindholm <david.lindholm@oralce.com> Reviewed-by: sjohanss, david, brutisso
This commit is contained in:
parent
581eb19018
commit
ffeb0bdad0
200 changed files with 3331 additions and 6147 deletions
|
@ -26,9 +26,11 @@
|
|||
#include "gc/parallel/gcTaskManager.hpp"
|
||||
#include "gc/parallel/gcTaskThread.hpp"
|
||||
#include "gc/shared/gcId.hpp"
|
||||
#include "logging/log.hpp"
|
||||
#include "memory/allocation.hpp"
|
||||
#include "memory/allocation.inline.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "runtime/atomic.inline.hpp"
|
||||
#include "runtime/handles.hpp"
|
||||
#include "runtime/handles.inline.hpp"
|
||||
#include "runtime/os.hpp"
|
||||
|
@ -45,11 +47,6 @@ GCTaskThread::GCTaskThread(GCTaskManager* manager,
|
|||
if (!os::create_thread(this, os::pgc_thread))
|
||||
vm_exit_out_of_memory(0, OOM_MALLOC_ERROR, "Cannot create GC thread. Out of system resources.");
|
||||
|
||||
if (PrintGCTaskTimeStamps) {
|
||||
_time_stamps = NEW_C_HEAP_ARRAY(GCTaskTimeStamp, GCTaskTimeStampEntries, mtGC);
|
||||
|
||||
guarantee(_time_stamps != NULL, "Sanity");
|
||||
}
|
||||
set_id(which);
|
||||
set_name("ParGC Thread#%d", which);
|
||||
}
|
||||
|
@ -66,21 +63,30 @@ void GCTaskThread::start() {
|
|||
|
||||
GCTaskTimeStamp* GCTaskThread::time_stamp_at(uint index) {
|
||||
guarantee(index < GCTaskTimeStampEntries, "increase GCTaskTimeStampEntries");
|
||||
if (_time_stamps == NULL) {
|
||||
// We allocate the _time_stamps array lazily since logging can be enabled dynamically
|
||||
GCTaskTimeStamp* time_stamps = NEW_C_HEAP_ARRAY(GCTaskTimeStamp, GCTaskTimeStampEntries, mtGC);
|
||||
void* old = Atomic::cmpxchg_ptr(time_stamps, &_time_stamps, NULL);
|
||||
if (old != NULL) {
|
||||
// Someone already setup the time stamps
|
||||
FREE_C_HEAP_ARRAY(GCTaskTimeStamp, time_stamps);
|
||||
}
|
||||
}
|
||||
|
||||
return &(_time_stamps[index]);
|
||||
}
|
||||
|
||||
void GCTaskThread::print_task_time_stamps() {
|
||||
assert(PrintGCTaskTimeStamps, "Sanity");
|
||||
assert(_time_stamps != NULL, "Sanity (Probably set PrintGCTaskTimeStamps late)");
|
||||
assert(log_is_enabled(Debug, gc, task, time), "Sanity");
|
||||
assert(_time_stamps != NULL, "Sanity");
|
||||
|
||||
tty->print_cr("GC-Thread %u entries: %d", id(), _time_stamp_index);
|
||||
log_debug(gc, task, time)("GC-Thread %u entries: %d", id(), _time_stamp_index);
|
||||
for(uint i=0; i<_time_stamp_index; i++) {
|
||||
GCTaskTimeStamp* time_stamp = time_stamp_at(i);
|
||||
tty->print_cr("\t[ %s " JLONG_FORMAT " " JLONG_FORMAT " ]",
|
||||
time_stamp->name(),
|
||||
time_stamp->entry_time(),
|
||||
time_stamp->exit_time());
|
||||
log_debug(gc, task, time)("\t[ %s " JLONG_FORMAT " " JLONG_FORMAT " ]",
|
||||
time_stamp->name(),
|
||||
time_stamp->entry_time(),
|
||||
time_stamp->exit_time());
|
||||
}
|
||||
|
||||
// Reset after dumping the data
|
||||
|
@ -127,7 +133,7 @@ void GCTaskThread::run() {
|
|||
// Record if this is an idle task for later use.
|
||||
bool is_idle_task = task->is_idle_task();
|
||||
// In case the update is costly
|
||||
if (PrintGCTaskTimeStamps) {
|
||||
if (log_is_enabled(Debug, gc, task, time)) {
|
||||
timer.update();
|
||||
}
|
||||
|
||||
|
@ -143,10 +149,7 @@ void GCTaskThread::run() {
|
|||
if (!is_idle_task) {
|
||||
manager()->note_completion(which());
|
||||
|
||||
if (PrintGCTaskTimeStamps) {
|
||||
assert(_time_stamps != NULL,
|
||||
"Sanity (PrintGCTaskTimeStamps set late?)");
|
||||
|
||||
if (log_is_enabled(Debug, gc, task, time)) {
|
||||
timer.update();
|
||||
|
||||
GCTaskTimeStamp* time_stamp = time_stamp_at(_time_stamp_index++);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue