src/share/vm/runtime/thread.cpp
Print this page
rev 13113 : 8182651: Add TRACE_ONLY conditional macro to support more fine-grained INCLUDE_TRACE programming
Reviewed-by:
*** 91,102 ****
#include "runtime/vm_version.hpp"
#include "services/attachListener.hpp"
#include "services/management.hpp"
#include "services/memTracker.hpp"
#include "services/threadService.hpp"
- #include "trace/traceMacros.hpp"
- #include "trace/tracing.hpp"
#include "utilities/defaultStream.hpp"
#include "utilities/dtrace.hpp"
#include "utilities/events.hpp"
#include "utilities/macros.hpp"
#include "utilities/preserveException.hpp"
--- 91,100 ----
*** 117,126 ****
--- 115,128 ----
#include "opto/idealGraphPrinter.hpp"
#endif
#if INCLUDE_RTM_OPT
#include "runtime/rtmLocking.hpp"
#endif
+ #if INCLUDE_TRACE
+ #include "trace/traceMacros.hpp"
+ #include "trace/tracing.hpp"
+ #endif
// Initialization after module runtime initialization
void universe_post_module_init(); // must happen after call_initPhase2
#ifdef DTRACE_ENABLED
*** 1661,1670 ****
--- 1663,1690 ----
FREE_C_HEAP_ARRAY(jlong, _jvmci_counters);
}
#endif // INCLUDE_JVMCI
}
+ #if INCLUDE_TRACE
+ static void post_thread_start_event(const JavaThread* jt) {
+ assert(jt != NULL, "invariant");
+ EventThreadStart event;
+ if (event.should_commit()) {
+ event.set_thread(THREAD_TRACE_ID(jt));
+ event.commit();
+ }
+ }
+
+ static void post_thread_end_event(const JavaThread* jt) {
+ EventThreadEnd event;
+ if (event.should_commit()) {
+ event.set_thread(THREAD_TRACE_ID(jt));
+ event.commit();
+ }
+ }
+ #endif // INCLUDE_TRACE
// The first routine called by a new Java thread
void JavaThread::run() {
// initialize thread-local alloc buffer related fields
this->initialize_tlab();
*** 1694,1708 ****
if (JvmtiExport::should_post_thread_life()) {
JvmtiExport::post_thread_start(this);
}
! EventThreadStart event;
! if (event.should_commit()) {
! event.set_thread(THREAD_TRACE_ID(this));
! event.commit();
! }
// We call another function to do the rest so we are sure that the stack addresses used
// from there will be lower than the stack base just computed
thread_main_inner();
--- 1714,1724 ----
if (JvmtiExport::should_post_thread_life()) {
JvmtiExport::post_thread_start(this);
}
! TRACE_ONLY(post_thread_start_event(this));
// We call another function to do the rest so we are sure that the stack addresses used
// from there will be lower than the stack base just computed
thread_main_inner();
*** 1799,1813 ****
}
}
// Called before the java thread exit since we want to read info
// from java_lang_Thread object
! EventThreadEnd event;
! if (event.should_commit()) {
! event.set_thread(THREAD_TRACE_ID(this));
! event.commit();
! }
// Call after last event on thread
EVENT_THREAD_EXIT(this);
// Call Thread.exit(). We try 3 times in case we got another Thread.stop during
--- 1815,1825 ----
}
}
// Called before the java thread exit since we want to read info
// from java_lang_Thread object
! TRACE_ONLY(post_thread_end_event(this);)
// Call after last event on thread
EVENT_THREAD_EXIT(this);
// Call Thread.exit(). We try 3 times in case we got another Thread.stop during