equal
deleted
inserted
replaced
21 * questions. |
21 * questions. |
22 * |
22 * |
23 */ |
23 */ |
24 |
24 |
25 #include "precompiled.hpp" |
25 #include "precompiled.hpp" |
|
26 #include "jfr/jni/jfrJavaSupport.hpp" |
26 #include "jfr/periodic/jfrThreadCPULoadEvent.hpp" |
27 #include "jfr/periodic/jfrThreadCPULoadEvent.hpp" |
27 #include "jfr/jni/jfrJavaSupport.hpp" |
28 #include "jfr/recorder/jfrRecorder.hpp" |
28 #include "jfr/recorder/checkpoint/jfrCheckpointManager.hpp" |
29 #include "jfr/recorder/checkpoint/jfrCheckpointManager.hpp" |
29 #include "jfr/recorder/checkpoint/types/traceid/jfrTraceId.inline.hpp" |
30 #include "jfr/recorder/checkpoint/types/traceid/jfrTraceId.inline.hpp" |
30 #include "jfr/recorder/service/jfrOptionSet.hpp" |
31 #include "jfr/recorder/service/jfrOptionSet.hpp" |
31 #include "jfr/recorder/storage/jfrStorage.hpp" |
32 #include "jfr/recorder/storage/jfrStorage.hpp" |
32 #include "jfr/recorder/stacktrace/jfrStackTraceRepository.hpp" |
33 #include "jfr/recorder/stacktrace/jfrStackTraceRepository.hpp" |
49 _user_time(0), |
50 _user_time(0), |
50 _cpu_time(0), |
51 _cpu_time(0), |
51 _wallclock_time(os::javaTimeNanos()), |
52 _wallclock_time(os::javaTimeNanos()), |
52 _stack_trace_hash(0), |
53 _stack_trace_hash(0), |
53 _stackdepth(0), |
54 _stackdepth(0), |
54 _entering_suspend_flag(0) {} |
55 _entering_suspend_flag(0), |
|
56 _dead(false) {} |
55 |
57 |
56 u8 JfrThreadLocal::add_data_lost(u8 value) { |
58 u8 JfrThreadLocal::add_data_lost(u8 value) { |
57 _data_lost += value; |
59 _data_lost += value; |
58 return _data_lost; |
60 return _data_lost; |
59 } |
61 } |
69 |
71 |
70 const JfrCheckpointBlobHandle& JfrThreadLocal::thread_checkpoint() const { |
72 const JfrCheckpointBlobHandle& JfrThreadLocal::thread_checkpoint() const { |
71 return _thread_cp; |
73 return _thread_cp; |
72 } |
74 } |
73 |
75 |
|
76 void JfrThreadLocal::set_dead() { |
|
77 assert(!is_dead(), "invariant"); |
|
78 _dead = true; |
|
79 } |
|
80 |
74 void JfrThreadLocal::on_exit(JavaThread* thread) { |
81 void JfrThreadLocal::on_exit(JavaThread* thread) { |
75 JfrCheckpointManager::write_thread_checkpoint(thread); |
82 if (JfrRecorder::is_recording()) { |
76 JfrThreadCPULoadEvent::send_event_for_thread(thread); |
83 JfrCheckpointManager::write_thread_checkpoint(thread); |
|
84 JfrThreadCPULoadEvent::send_event_for_thread(thread); |
|
85 } |
|
86 thread->jfr_thread_local()->set_dead(); |
77 } |
87 } |
78 |
88 |
79 void JfrThreadLocal::on_destruct(Thread* thread) { |
89 void JfrThreadLocal::on_destruct(Thread* thread) { |
80 JfrThreadLocal* const tl = thread->jfr_thread_local(); |
90 JfrThreadLocal* const tl = thread->jfr_thread_local(); |
81 if (tl->has_native_buffer()) { |
91 if (tl->has_native_buffer()) { |