8237499: JFR: Include stack trace in the ThreadStart event

Reviewed-by: egahlin
This commit is contained in:
Denghui Dong 2020-02-24 23:24:14 +01:00
parent 8493812702
commit 52d7a61e8d
8 changed files with 54 additions and 8 deletions

View file

@ -94,6 +94,7 @@
#endif
#include <errno.h>
#include <jfr/recorder/jfrRecorder.hpp>
/*
NOTE about use of any ctor or function call that can trigger a safepoint/GC:
@ -2882,6 +2883,15 @@ JVM_ENTRY(void, JVM_StartThread(JNIEnv* env, jobject jthread))
os::native_thread_creation_failed_msg());
}
#if INCLUDE_JFR
if (JfrRecorder::is_recording() && EventThreadStart::is_enabled() &&
EventThreadStart::is_stacktrace_enabled()) {
JfrThreadLocal* tl = native_thread->jfr_thread_local();
// skip Thread.start() and Thread.start0()
tl->set_cached_stack_trace_id(JfrStackTraceRepository::record(thread, 2));
}
#endif
Thread::start(native_thread);
JVM_END