23 */ |
23 */ |
24 |
24 |
25 #ifndef SHARE_JFR_LEAKPROFILER_STARTOPERATION_HPP |
25 #ifndef SHARE_JFR_LEAKPROFILER_STARTOPERATION_HPP |
26 #define SHARE_JFR_LEAKPROFILER_STARTOPERATION_HPP |
26 #define SHARE_JFR_LEAKPROFILER_STARTOPERATION_HPP |
27 |
27 |
28 #include "jfr/recorder/jfrRecorder.hpp" |
|
29 #include "jfr/leakprofiler/leakProfiler.hpp" |
|
30 #include "jfr/leakprofiler/sampling/objectSampler.hpp" |
28 #include "jfr/leakprofiler/sampling/objectSampler.hpp" |
31 #include "jfr/recorder/service/jfrOptionSet.hpp" |
29 #include "jfr/leakprofiler/utilities/vmOperation.hpp" |
32 #include "logging/log.hpp" |
|
33 #include "runtime/vmOperations.hpp" |
|
34 |
30 |
35 // Safepoint operation for starting leak profiler object sampler |
31 // Safepoint operation for creating and starting the leak profiler object sampler |
36 class StartOperation : public VM_Operation { |
32 class StartOperation : public OldObjectVMOperation { |
37 private: |
33 private: |
38 jlong _sample_count; |
34 int _sample_count; |
39 public: |
35 public: |
40 StartOperation(jlong sample_count) : |
36 StartOperation(int sample_count) : _sample_count(sample_count) {} |
41 _sample_count(sample_count) { |
|
42 } |
|
43 |
|
44 Mode evaluation_mode() const { |
|
45 return _safepoint; |
|
46 } |
|
47 |
|
48 VMOp_Type type() const { |
|
49 return VMOp_GC_HeapInspection; |
|
50 } |
|
51 |
37 |
52 virtual void doit() { |
38 virtual void doit() { |
53 assert(!LeakProfiler::is_running(), "invariant"); |
39 ObjectSampler::create(_sample_count); |
54 jint queue_size = JfrOptionSet::old_object_queue_size(); |
|
55 LeakProfiler::set_object_sampler(new ObjectSampler(queue_size)); |
|
56 log_trace(jfr, system)( "Object sampling started"); |
|
57 } |
40 } |
58 }; |
41 }; |
59 |
42 |
60 #endif // SHARE_JFR_LEAKPROFILER_STARTOPERATION_HPP |
43 #endif // SHARE_JFR_LEAKPROFILER_STARTOPERATION_HPP |