< prev index next >

src/hotspot/share/jfr/leakprofiler/leakProfiler.cpp

Print this page




  30 #include "jfr/leakprofiler/sampling/objectSampler.hpp"
  31 #include "jfr/recorder/service/jfrOptionSet.hpp"
  32 #include "memory/iterator.hpp"
  33 #include "oops/oop.hpp"
  34 #include "runtime/atomic.hpp"
  35 #include "runtime/orderAccess.hpp"
  36 #include "runtime/thread.inline.hpp"
  37 #include "runtime/vmThread.hpp"
  38 #include "utilities/ostream.hpp"
  39 
  40 // Only to be updated during safepoint
  41 ObjectSampler* LeakProfiler::_object_sampler = NULL;
  42 
  43 static volatile jbyte suspended = 0;
  44 bool LeakProfiler::start(jint sample_count) {
  45   if (UseZGC) {
  46     log_warning(jfr)("LeakProfiler is currently not supported in combination with ZGC");
  47     return false;
  48   }
  49 





  50   if (_object_sampler != NULL) {
  51     // already started
  52     return true;
  53   }
  54   // Allows user to disable leak profiler on command line by setting queue size to zero.
  55   if (sample_count > 0) {
  56     StartOperation op(sample_count);
  57     VMThread::execute(&op);
  58     return _object_sampler != NULL;
  59   }
  60   return false;
  61 }
  62 
  63 bool LeakProfiler::stop() {
  64   if (_object_sampler == NULL) {
  65     // already stopped/not started
  66     return true;
  67   }
  68   StopOperation op;
  69   VMThread::execute(&op);




  30 #include "jfr/leakprofiler/sampling/objectSampler.hpp"
  31 #include "jfr/recorder/service/jfrOptionSet.hpp"
  32 #include "memory/iterator.hpp"
  33 #include "oops/oop.hpp"
  34 #include "runtime/atomic.hpp"
  35 #include "runtime/orderAccess.hpp"
  36 #include "runtime/thread.inline.hpp"
  37 #include "runtime/vmThread.hpp"
  38 #include "utilities/ostream.hpp"
  39 
  40 // Only to be updated during safepoint
  41 ObjectSampler* LeakProfiler::_object_sampler = NULL;
  42 
  43 static volatile jbyte suspended = 0;
  44 bool LeakProfiler::start(jint sample_count) {
  45   if (UseZGC) {
  46     log_warning(jfr)("LeakProfiler is currently not supported in combination with ZGC");
  47     return false;
  48   }
  49 
  50   if (UseShenandoahGC) {
  51     log_warning(jfr)("LeakProfiler is currently not supported in combination with Shenandoah GC");
  52     return false;
  53   }
  54 
  55   if (_object_sampler != NULL) {
  56     // already started
  57     return true;
  58   }
  59   // Allows user to disable leak profiler on command line by setting queue size to zero.
  60   if (sample_count > 0) {
  61     StartOperation op(sample_count);
  62     VMThread::execute(&op);
  63     return _object_sampler != NULL;
  64   }
  65   return false;
  66 }
  67 
  68 bool LeakProfiler::stop() {
  69   if (_object_sampler == NULL) {
  70     // already stopped/not started
  71     return true;
  72   }
  73   StopOperation op;
  74   VMThread::execute(&op);


< prev index next >