8302508: Add timestamp to the output TraceCompilerThreads
Reviewed-by: thartmann
This commit is contained in:
parent
404d5bddb9
commit
f813dc7183
@ -904,6 +904,21 @@ JavaThread* CompileBroker::make_thread(ThreadType type, jobject thread_handle, C
|
||||
return new_thread;
|
||||
}
|
||||
|
||||
static bool trace_compiler_threads() {
|
||||
LogTarget(Debug, jit, thread) lt;
|
||||
return TraceCompilerThreads || lt.is_enabled();
|
||||
}
|
||||
|
||||
static void print_compiler_threads(stringStream& msg) {
|
||||
if (TraceCompilerThreads) {
|
||||
tty->print_cr("%7d %s", (int)tty->time_stamp().milliseconds(), msg.as_string());
|
||||
}
|
||||
LogTarget(Debug, jit, thread) lt;
|
||||
if (lt.is_enabled()) {
|
||||
LogStream ls(lt);
|
||||
ls.print_cr("%s", msg.as_string());
|
||||
}
|
||||
}
|
||||
|
||||
void CompileBroker::init_compiler_threads() {
|
||||
// Ensure any exceptions lead to vm_exit_during_initialization.
|
||||
@ -943,11 +958,13 @@ void CompileBroker::init_compiler_threads() {
|
||||
JavaThread *ct = make_thread(compiler_t, thread_handle, _c2_compile_queue, _compilers[1], THREAD);
|
||||
assert(ct != nullptr, "should have been handled for initial thread");
|
||||
_compilers[1]->set_num_compiler_threads(i + 1);
|
||||
if (TraceCompilerThreads) {
|
||||
if (trace_compiler_threads()) {
|
||||
ResourceMark rm;
|
||||
ThreadsListHandle tlh; // name() depends on the TLH.
|
||||
assert(tlh.includes(ct), "ct=" INTPTR_FORMAT " exited unexpectedly.", p2i(ct));
|
||||
tty->print_cr("Added initial compiler thread %s", ct->name());
|
||||
stringStream msg;
|
||||
msg.print("Added initial compiler thread %s", ct->name());
|
||||
print_compiler_threads(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -964,11 +981,13 @@ void CompileBroker::init_compiler_threads() {
|
||||
JavaThread *ct = make_thread(compiler_t, thread_handle, _c1_compile_queue, _compilers[0], THREAD);
|
||||
assert(ct != nullptr, "should have been handled for initial thread");
|
||||
_compilers[0]->set_num_compiler_threads(i + 1);
|
||||
if (TraceCompilerThreads) {
|
||||
if (trace_compiler_threads()) {
|
||||
ResourceMark rm;
|
||||
ThreadsListHandle tlh; // name() depends on the TLH.
|
||||
assert(tlh.includes(ct), "ct=" INTPTR_FORMAT " exited unexpectedly.", p2i(ct));
|
||||
tty->print_cr("Added initial compiler thread %s", ct->name());
|
||||
stringStream msg;
|
||||
msg.print("Added initial compiler thread %s", ct->name());
|
||||
print_compiler_threads(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1026,10 +1045,12 @@ void CompileBroker::possibly_add_compiler_threads(JavaThread* THREAD) {
|
||||
thread_oop = create_thread_oop(name_buffer, THREAD);
|
||||
}
|
||||
if (HAS_PENDING_EXCEPTION) {
|
||||
if (TraceCompilerThreads) {
|
||||
if (trace_compiler_threads()) {
|
||||
ResourceMark rm;
|
||||
tty->print_cr("JVMCI compiler thread creation failed:");
|
||||
PENDING_EXCEPTION->print();
|
||||
stringStream msg;
|
||||
msg.print_cr("JVMCI compiler thread creation failed:");
|
||||
PENDING_EXCEPTION->print_on(&msg);
|
||||
print_compiler_threads(msg);
|
||||
}
|
||||
CLEAR_PENDING_EXCEPTION;
|
||||
break;
|
||||
@ -1044,12 +1065,14 @@ void CompileBroker::possibly_add_compiler_threads(JavaThread* THREAD) {
|
||||
JavaThread *ct = make_thread(compiler_t, compiler2_object(i), _c2_compile_queue, _compilers[1], THREAD);
|
||||
if (ct == nullptr) break;
|
||||
_compilers[1]->set_num_compiler_threads(i + 1);
|
||||
if (TraceCompilerThreads) {
|
||||
if (trace_compiler_threads()) {
|
||||
ResourceMark rm;
|
||||
ThreadsListHandle tlh; // name() depends on the TLH.
|
||||
assert(tlh.includes(ct), "ct=" INTPTR_FORMAT " exited unexpectedly.", p2i(ct));
|
||||
tty->print_cr("Added compiler thread %s (available memory: %dMB, available non-profiled code cache: %dMB)",
|
||||
ct->name(), (int)(available_memory/M), (int)(available_cc_np/M));
|
||||
stringStream msg;
|
||||
msg.print("Added compiler thread %s (available memory: %dMB, available non-profiled code cache: %dMB)",
|
||||
ct->name(), (int)(available_memory/M), (int)(available_cc_np/M));
|
||||
print_compiler_threads(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1065,12 +1088,14 @@ void CompileBroker::possibly_add_compiler_threads(JavaThread* THREAD) {
|
||||
JavaThread *ct = make_thread(compiler_t, compiler1_object(i), _c1_compile_queue, _compilers[0], THREAD);
|
||||
if (ct == nullptr) break;
|
||||
_compilers[0]->set_num_compiler_threads(i + 1);
|
||||
if (TraceCompilerThreads) {
|
||||
if (trace_compiler_threads()) {
|
||||
ResourceMark rm;
|
||||
ThreadsListHandle tlh; // name() depends on the TLH.
|
||||
assert(tlh.includes(ct), "ct=" INTPTR_FORMAT " exited unexpectedly.", p2i(ct));
|
||||
tty->print_cr("Added compiler thread %s (available memory: %dMB, available profiled code cache: %dMB)",
|
||||
ct->name(), (int)(available_memory/M), (int)(available_cc_p/M));
|
||||
stringStream msg;
|
||||
msg.print("Added compiler thread %s (available memory: %dMB, available profiled code cache: %dMB)",
|
||||
ct->name(), (int)(available_memory/M), (int)(available_cc_p/M));
|
||||
print_compiler_threads(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1885,9 +1910,12 @@ void CompileBroker::compiler_thread_loop() {
|
||||
// Access compiler_count under lock to enforce consistency.
|
||||
MutexLocker only_one(CompileThread_lock);
|
||||
if (can_remove(thread, true)) {
|
||||
if (TraceCompilerThreads) {
|
||||
tty->print_cr("Removing compiler thread %s after " JLONG_FORMAT " ms idle time",
|
||||
thread->name(), thread->idle_time_millis());
|
||||
if (trace_compiler_threads()) {
|
||||
ResourceMark rm;
|
||||
stringStream msg;
|
||||
msg.print("Removing compiler thread %s after " JLONG_FORMAT " ms idle time",
|
||||
thread->name(), thread->idle_time_millis());
|
||||
print_compiler_threads(msg);
|
||||
}
|
||||
|
||||
// Notify compiler that the compiler thread is about to stop
|
||||
|
Loading…
x
Reference in New Issue
Block a user