< prev index next >

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

Print this page




  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 INCLUDE_SHENANDOAHGC
  57   if (UseShenandoahGC) {
  58     log_warning(jfr)("LeakProfiler is currently not supported in combination with Shenandoah GC");
  59     return false;
  60   }
  61 #endif
  62 
  63   assert(!is_running(), "invariant");
  64   assert(sample_count > 0, "invariant");
  65 
  66   // schedule the safepoint operation for installing the object sampler
  67   StartOperation op(sample_count);
  68   VMThread::execute(&op);
  69 
  70   if (!is_running()) {
  71     log_trace(jfr, system)("Object sampling could not be started because the sampler could not be allocated");
  72     return false;
  73   }
  74   assert(is_running(), "invariant");
  75   log_trace(jfr, system)("Object sampling started");
  76   return true;
  77 }
  78 
  79 bool LeakProfiler::stop() {
  80   if (!is_running()) {
  81     return false;
  82   }


< prev index next >