mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-24 05:14:52 +02:00
8149036: Add tracing for thread related events at os level
Reviewed-by: coleenp, mlarsson, dholmes
This commit is contained in:
parent
35a916a2a1
commit
3634fb9df2
9 changed files with 187 additions and 44 deletions
|
@ -662,6 +662,9 @@ static void *java_start(Thread *thread) {
|
|||
|
||||
osthread->set_thread_id(os::current_thread_id());
|
||||
|
||||
log_info(os, thread)("Thread is alive (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT ").",
|
||||
os::current_thread_id(), (uintx) pthread_self());
|
||||
|
||||
if (UseNUMA) {
|
||||
int lgrp_id = os::numa_get_group_id();
|
||||
if (lgrp_id != -1) {
|
||||
|
@ -691,6 +694,9 @@ static void *java_start(Thread *thread) {
|
|||
// call one more level start routine
|
||||
thread->run();
|
||||
|
||||
log_info(os, thread)("Thread finished (tid " UINTX_FORMAT ", pthread id " UINTX_FORMAT ").",
|
||||
os::current_thread_id(), (uintx) pthread_self());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -756,12 +762,18 @@ bool os::create_thread(Thread* thread, ThreadType thr_type,
|
|||
pthread_t tid;
|
||||
int ret = pthread_create(&tid, &attr, (void* (*)(void*)) java_start, thread);
|
||||
|
||||
char buf[64];
|
||||
if (ret == 0) {
|
||||
log_info(os, thread)("Thread started (pthread id: " UINTX_FORMAT ", attributes: %s). ",
|
||||
(uintx) tid, os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
|
||||
} else {
|
||||
log_warning(os, thread)("Failed to start thread - pthread_create failed (%s) for attributes: %s.",
|
||||
strerror(ret), os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
|
||||
}
|
||||
|
||||
pthread_attr_destroy(&attr);
|
||||
|
||||
if (ret != 0) {
|
||||
if (PrintMiscellaneous && (Verbose || WizardMode)) {
|
||||
perror("pthread_create()");
|
||||
}
|
||||
// Need to clean up stuff we've allocated so far
|
||||
thread->set_osthread(NULL);
|
||||
delete osthread;
|
||||
|
@ -858,6 +870,9 @@ bool os::create_attached_thread(JavaThread* thread) {
|
|||
// and save the caller's signal mask
|
||||
os::Linux::hotspot_sigmask(thread);
|
||||
|
||||
log_info(os, thread)("Thread attached (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT ").",
|
||||
os::current_thread_id(), (uintx) pthread_self());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue