equal
deleted
inserted
replaced
29 #include "jfr/leakprofiler/checkpoint/eventEmitter.hpp" |
29 #include "jfr/leakprofiler/checkpoint/eventEmitter.hpp" |
30 #include "jfr/leakprofiler/sampling/objectSampler.hpp" |
30 #include "jfr/leakprofiler/sampling/objectSampler.hpp" |
31 #include "jfr/recorder/service/jfrOptionSet.hpp" |
31 #include "jfr/recorder/service/jfrOptionSet.hpp" |
32 #include "logging/log.hpp" |
32 #include "logging/log.hpp" |
33 #include "memory/iterator.hpp" |
33 #include "memory/iterator.hpp" |
|
34 #include "runtime/mutexLocker.hpp" |
34 #include "runtime/thread.inline.hpp" |
35 #include "runtime/thread.inline.hpp" |
35 #include "runtime/vmThread.hpp" |
36 #include "runtime/vmThread.hpp" |
36 |
37 |
37 bool LeakProfiler::is_running() { |
38 bool LeakProfiler::is_running() { |
38 return ObjectSampler::is_created(); |
39 return ObjectSampler::is_created(); |
90 |
91 |
91 void LeakProfiler::emit_events(int64_t cutoff_ticks, bool emit_all) { |
92 void LeakProfiler::emit_events(int64_t cutoff_ticks, bool emit_all) { |
92 if (!is_running()) { |
93 if (!is_running()) { |
93 return; |
94 return; |
94 } |
95 } |
|
96 MutexLocker lock(JfrStream_lock); |
95 // exclusive access to object sampler instance |
97 // exclusive access to object sampler instance |
96 ObjectSampler* const sampler = ObjectSampler::acquire(); |
98 ObjectSampler* const sampler = ObjectSampler::acquire(); |
97 assert(sampler != NULL, "invariant"); |
99 assert(sampler != NULL, "invariant"); |
98 EventEmitter::emit(sampler, cutoff_ticks, emit_all); |
100 EventEmitter::emit(sampler, cutoff_ticks, emit_all); |
99 ObjectSampler::release(); |
101 ObjectSampler::release(); |