36
37 bool LeakProfiler::is_running() {
38 return ObjectSampler::is_created();
39 }
40
41 bool LeakProfiler::start(int sample_count) {
42 if (is_running()) {
43 return true;
44 }
45
46 // Allows user to disable leak profiler on command line by setting queue size to zero.
47 if (sample_count == 0) {
48 return false;
49 }
50
51 if (UseZGC) {
52 log_warning(jfr)("LeakProfiler is currently not supported in combination with ZGC");
53 return false;
54 }
55
56 assert(!is_running(), "invariant");
57 assert(sample_count > 0, "invariant");
58
59 // schedule the safepoint operation for installing the object sampler
60 StartOperation op(sample_count);
61 VMThread::execute(&op);
62
63 if (!is_running()) {
64 log_trace(jfr, system)("Object sampling could not be started because the sampler could not be allocated");
65 return false;
66 }
67 assert(is_running(), "invariant");
68 log_trace(jfr, system)("Object sampling started");
69 return true;
70 }
71
72 bool LeakProfiler::stop() {
73 if (!is_running()) {
74 return false;
75 }
|
36
37 bool LeakProfiler::is_running() {
38 return ObjectSampler::is_created();
39 }
40
41 bool LeakProfiler::start(int sample_count) {
42 if (is_running()) {
43 return true;
44 }
45
46 // Allows user to disable leak profiler on command line by setting queue size to zero.
47 if (sample_count == 0) {
48 return false;
49 }
50
51 if (UseZGC) {
52 log_warning(jfr)("LeakProfiler is currently not supported in combination with ZGC");
53 return false;
54 }
55
56 if (UseShenandoahGC) {
57 log_warning(jfr)("LeakProfiler is currently not supported in combination with Shenandoah GC");
58 return false;
59 }
60
61 assert(!is_running(), "invariant");
62 assert(sample_count > 0, "invariant");
63
64 // schedule the safepoint operation for installing the object sampler
65 StartOperation op(sample_count);
66 VMThread::execute(&op);
67
68 if (!is_running()) {
69 log_trace(jfr, system)("Object sampling could not be started because the sampler could not be allocated");
70 return false;
71 }
72 assert(is_running(), "invariant");
73 log_trace(jfr, system)("Object sampling started");
74 return true;
75 }
76
77 bool LeakProfiler::stop() {
78 if (!is_running()) {
79 return false;
80 }
|