src/share/vm/runtime/thread.cpp

Print this page
rev 4773 : 8005849: JEP 167: Event-Based JVM Tracing
Reviewed-by: acorn, coleenp, sla
Contributed-by: Karen Kinnear <karen.kinnear@oracle.com>, Bengt Rutisson <bengt.rutisson@oracle.com>, Calvin Cheung <calvin.cheung@oracle.com>, Erik Gahlin <erik.gahlin@oracle.com>, Erik Helin <erik.helin@oracle.com>, Jesper Wilhelmsson <jesper.wilhelmsson@oracle.com>, Keith McGuigan <keith.mcguigan@oracle.com>, Mattias Tobiasson <mattias.tobiasson@oracle.com>, Markus Gronlund <markus.gronlund@oracle.com>, Mikael Auno <mikael.auno@oracle.com>, Nils Eliasson <nils.eliasson@oracle.com>, Nils Loodin <nils.loodin@oracle.com>, Rickard Backman <rickard.backman@oracle.com>, Staffan Larsen <staffan.larsen@oracle.com>, Stefan Karlsson <stefan.karlsson@oracle.com>, Yekaterina Kantserova <yekaterina.kantserova@oracle.com>

*** 75,85 **** #include "runtime/vm_operations.hpp" #include "services/attachListener.hpp" #include "services/management.hpp" #include "services/memTracker.hpp" #include "services/threadService.hpp" ! #include "trace/traceEventTypes.hpp" #include "utilities/defaultStream.hpp" #include "utilities/dtrace.hpp" #include "utilities/events.hpp" #include "utilities/preserveException.hpp" #include "utilities/macros.hpp" --- 75,86 ---- #include "runtime/vm_operations.hpp" #include "services/attachListener.hpp" #include "services/management.hpp" #include "services/memTracker.hpp" #include "services/threadService.hpp" ! #include "trace/tracing.hpp" ! #include "trace/traceMacros.hpp" #include "utilities/defaultStream.hpp" #include "utilities/dtrace.hpp" #include "utilities/events.hpp" #include "utilities/preserveException.hpp" #include "utilities/macros.hpp"
*** 236,246 **** NOT_PRODUCT(_allow_safepoint_count = 0;) NOT_PRODUCT(_skip_gcalot = false;) CHECK_UNHANDLED_OOPS_ONLY(_gc_locked_out_count = 0;) _jvmti_env_iteration_count = 0; set_allocated_bytes(0); - set_trace_buffer(NULL); _vm_operation_started_count = 0; _vm_operation_completed_count = 0; _current_pending_monitor = NULL; _current_pending_monitor_is_from_java = true; _current_waiting_monitor = NULL; --- 237,246 ----
*** 1657,1669 **** if (JvmtiExport::should_post_thread_life()) { JvmtiExport::post_thread_start(this); } ! EVENT_BEGIN(TraceEventThreadStart, event); ! EVENT_COMMIT(event, ! EVENT_SET(event, javalangthread, java_lang_Thread::thread_id(this->threadObj()))); // 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(); --- 1657,1671 ---- if (JvmtiExport::should_post_thread_life()) { JvmtiExport::post_thread_start(this); } ! EventThreadStart event; ! if (event.should_commit()) { ! event.set_javalangthread(java_lang_Thread::thread_id(this->threadObj())); ! 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();
*** 1789,1801 **** } } // Called before the java thread exit since we want to read info // from java_lang_Thread object ! EVENT_BEGIN(TraceEventThreadEnd, event); ! EVENT_COMMIT(event, ! EVENT_SET(event, javalangthread, java_lang_Thread::thread_id(this->threadObj()))); // 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 --- 1791,1805 ---- } } // 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_javalangthread(java_lang_Thread::thread_id(this->threadObj())); ! 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
*** 3646,3657 **** } // Notify JVMTI agents that VM initialization is complete - nop if no agents. JvmtiExport::post_vm_initialized(); ! if (!TRACE_START()) { ! vm_exit_during_initialization(Handle(THREAD, PENDING_EXCEPTION)); } if (CleanChunkPoolAsync) { Chunk::start_chunk_pool_cleaner_task(); } --- 3650,3661 ---- } // Notify JVMTI agents that VM initialization is complete - nop if no agents. JvmtiExport::post_vm_initialized(); ! if (TRACE_START() != JNI_OK) { ! vm_exit_during_initialization("Failed to start tracing backend."); } if (CleanChunkPoolAsync) { Chunk::start_chunk_pool_cleaner_task(); }