equal
deleted
inserted
replaced
32 #include "jfr/leakprofiler/sampling/objectSampler.hpp" |
32 #include "jfr/leakprofiler/sampling/objectSampler.hpp" |
33 #include "logging/log.hpp" |
33 #include "logging/log.hpp" |
34 #include "memory/resourceArea.hpp" |
34 #include "memory/resourceArea.hpp" |
35 #include "oops/markWord.hpp" |
35 #include "oops/markWord.hpp" |
36 #include "oops/oop.inline.hpp" |
36 #include "oops/oop.inline.hpp" |
|
37 #include "runtime/mutexLocker.hpp" |
37 #include "runtime/thread.inline.hpp" |
38 #include "runtime/thread.inline.hpp" |
38 #include "runtime/vmThread.hpp" |
39 #include "runtime/vmThread.hpp" |
39 |
40 |
40 EventEmitter::EventEmitter(const JfrTicks& start_time, const JfrTicks& end_time) : |
41 EventEmitter::EventEmitter(const JfrTicks& start_time, const JfrTicks& end_time) : |
41 _start_time(start_time), |
42 _start_time(start_time), |
49 _jfr_thread_local->set_thread_id(_thread_id); |
50 _jfr_thread_local->set_thread_id(_thread_id); |
50 _jfr_thread_local->clear_cached_stack_trace(); |
51 _jfr_thread_local->clear_cached_stack_trace(); |
51 } |
52 } |
52 |
53 |
53 void EventEmitter::emit(ObjectSampler* sampler, int64_t cutoff_ticks, bool emit_all) { |
54 void EventEmitter::emit(ObjectSampler* sampler, int64_t cutoff_ticks, bool emit_all) { |
|
55 assert(JfrStream_lock->owned_by_self(), "invariant"); |
54 assert(sampler != NULL, "invariant"); |
56 assert(sampler != NULL, "invariant"); |
55 |
|
56 ResourceMark rm; |
57 ResourceMark rm; |
57 EdgeStore edge_store; |
58 EdgeStore edge_store; |
58 if (cutoff_ticks <= 0) { |
59 if (cutoff_ticks <= 0) { |
59 // no reference chains |
60 // no reference chains |
60 JfrTicks time_stamp = JfrTicks::now(); |
61 JfrTicks time_stamp = JfrTicks::now(); |
66 PathToGcRootsOperation op(sampler, &edge_store, cutoff_ticks, emit_all); |
67 PathToGcRootsOperation op(sampler, &edge_store, cutoff_ticks, emit_all); |
67 VMThread::execute(&op); |
68 VMThread::execute(&op); |
68 } |
69 } |
69 |
70 |
70 size_t EventEmitter::write_events(ObjectSampler* object_sampler, EdgeStore* edge_store, bool emit_all) { |
71 size_t EventEmitter::write_events(ObjectSampler* object_sampler, EdgeStore* edge_store, bool emit_all) { |
|
72 assert_locked_or_safepoint(JfrStream_lock); |
71 assert(_thread == Thread::current(), "invariant"); |
73 assert(_thread == Thread::current(), "invariant"); |
72 assert(_thread->jfr_thread_local() == _jfr_thread_local, "invariant"); |
74 assert(_thread->jfr_thread_local() == _jfr_thread_local, "invariant"); |
73 assert(object_sampler != NULL, "invariant"); |
75 assert(object_sampler != NULL, "invariant"); |
74 assert(edge_store != NULL, "invariant"); |
76 assert(edge_store != NULL, "invariant"); |
75 |
77 |