comparison src/share/vm/prims/jni.cpp @ 10405:f2110083203d

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>
author sla
date Mon, 10 Jun 2013 11:30:51 +0200
parents 6702da6b6082
children 836a62f43af9 97c5acae48be
comparison
equal deleted inserted replaced
10404:d0add7016434 10405:f2110083203d
72 #include "runtime/signature.hpp" 72 #include "runtime/signature.hpp"
73 #include "runtime/thread.inline.hpp" 73 #include "runtime/thread.inline.hpp"
74 #include "runtime/vm_operations.hpp" 74 #include "runtime/vm_operations.hpp"
75 #include "services/runtimeService.hpp" 75 #include "services/runtimeService.hpp"
76 #include "trace/tracing.hpp" 76 #include "trace/tracing.hpp"
77 #include "trace/traceEventTypes.hpp"
78 #include "utilities/defaultStream.hpp" 77 #include "utilities/defaultStream.hpp"
79 #include "utilities/dtrace.hpp" 78 #include "utilities/dtrace.hpp"
80 #include "utilities/events.hpp" 79 #include "utilities/events.hpp"
81 #include "utilities/histogram.hpp" 80 #include "utilities/histogram.hpp"
82 #ifdef TARGET_OS_FAMILY_linux 81 #ifdef TARGET_OS_FAMILY_linux
5012 return ret; 5011 return ret;
5013 } 5012 }
5014 5013
5015 #ifndef PRODUCT 5014 #ifndef PRODUCT
5016 5015
5016 #include "gc_implementation/shared/gcTimer.hpp"
5017 #include "gc_interface/collectedHeap.hpp" 5017 #include "gc_interface/collectedHeap.hpp"
5018 #if INCLUDE_ALL_GCS 5018 #if INCLUDE_ALL_GCS
5019 #include "gc_implementation/g1/heapRegionRemSet.hpp" 5019 #include "gc_implementation/g1/heapRegionRemSet.hpp"
5020 #endif 5020 #endif
5021 #include "utilities/quickSort.hpp" 5021 #include "utilities/quickSort.hpp"
5029 5029
5030 void execute_internal_vm_tests() { 5030 void execute_internal_vm_tests() {
5031 if (ExecuteInternalVMTests) { 5031 if (ExecuteInternalVMTests) {
5032 tty->print_cr("Running internal VM tests"); 5032 tty->print_cr("Running internal VM tests");
5033 run_unit_test(GlobalDefinitions::test_globals()); 5033 run_unit_test(GlobalDefinitions::test_globals());
5034 run_unit_test(GCTimerAllTest::all());
5034 run_unit_test(arrayOopDesc::test_max_array_length()); 5035 run_unit_test(arrayOopDesc::test_max_array_length());
5035 run_unit_test(CollectedHeap::test_is_in()); 5036 run_unit_test(CollectedHeap::test_is_in());
5036 run_unit_test(QuickSort::test_quick_sort()); 5037 run_unit_test(QuickSort::test_quick_sort());
5037 run_unit_test(AltHashing::test_alt_hash()); 5038 run_unit_test(AltHashing::test_alt_hash());
5038 #if INCLUDE_VM_STRUCTS 5039 #if INCLUDE_VM_STRUCTS
5129 // Notify JVMTI 5130 // Notify JVMTI
5130 if (JvmtiExport::should_post_thread_life()) { 5131 if (JvmtiExport::should_post_thread_life()) {
5131 JvmtiExport::post_thread_start(thread); 5132 JvmtiExport::post_thread_start(thread);
5132 } 5133 }
5133 5134
5134 EVENT_BEGIN(TraceEventThreadStart, event); 5135 EventThreadStart event;
5135 EVENT_COMMIT(event, 5136 if (event.should_commit()) {
5136 EVENT_SET(event, javalangthread, java_lang_Thread::thread_id(thread->threadObj()))); 5137 event.set_javalangthread(java_lang_Thread::thread_id(thread->threadObj()));
5138 event.commit();
5139 }
5137 5140
5138 // Check if we should compile all classes on bootclasspath 5141 // Check if we should compile all classes on bootclasspath
5139 NOT_PRODUCT(if (CompileTheWorld) ClassLoader::compile_the_world();) 5142 NOT_PRODUCT(if (CompileTheWorld) ClassLoader::compile_the_world();)
5140 NOT_PRODUCT(if (ReplayCompiles) ciReplay::replay(thread);) 5143 NOT_PRODUCT(if (ReplayCompiles) ciReplay::replay(thread);)
5141 // Since this is not a JVM_ENTRY we have to set the thread state manually before leaving. 5144 // Since this is not a JVM_ENTRY we have to set the thread state manually before leaving.
5332 // Notify the debugger 5335 // Notify the debugger
5333 if (JvmtiExport::should_post_thread_life()) { 5336 if (JvmtiExport::should_post_thread_life()) {
5334 JvmtiExport::post_thread_start(thread); 5337 JvmtiExport::post_thread_start(thread);
5335 } 5338 }
5336 5339
5337 EVENT_BEGIN(TraceEventThreadStart, event); 5340 EventThreadStart event;
5338 EVENT_COMMIT(event, 5341 if (event.should_commit()) {
5339 EVENT_SET(event, javalangthread, java_lang_Thread::thread_id(thread->threadObj()))); 5342 event.set_javalangthread(java_lang_Thread::thread_id(thread->threadObj()));
5343 event.commit();
5344 }
5340 5345
5341 *(JNIEnv**)penv = thread->jni_environment(); 5346 *(JNIEnv**)penv = thread->jni_environment();
5342 5347
5343 // Now leaving the VM, so change thread_state. This is normally automatically taken care 5348 // Now leaving the VM, so change thread_state. This is normally automatically taken care
5344 // of in the JVM_ENTRY. But in this situation we have to do it manually. Notice, that by 5349 // of in the JVM_ENTRY. But in this situation we have to do it manually. Notice, that by