< prev index next >

src/hotspot/share/prims/jvmtiEnv.cpp

Print this page
rev 49264 : [mq]: event-only
rev 49267 : [mq]: event5
rev 49268 : [mq]: event6
rev 49269 : [mq]: event7

@@ -61,10 +61,11 @@
 #include "runtime/jniHandles.inline.hpp"
 #include "runtime/osThread.hpp"
 #include "runtime/reflectionUtils.hpp"
 #include "runtime/signature.hpp"
 #include "runtime/thread.inline.hpp"
+#include "runtime/threadHeapSampler.hpp"
 #include "runtime/threadSMR.hpp"
 #include "runtime/timerTrace.hpp"
 #include "runtime/vframe.hpp"
 #include "runtime/vmThread.hpp"
 #include "services/threadService.hpp"

@@ -534,10 +535,17 @@
     }
 
     if (event_type == JVMTI_EVENT_CLASS_FILE_LOAD_HOOK && enabled) {
       record_class_file_load_hook_enabled();
     }
+    if (event_type == JVMTI_EVENT_SAMPLED_OBJECT_ALLOC) {
+      if (enabled) {
+        ThreadHeapSampler::enable();
+      } else {
+        ThreadHeapSampler::disable();
+      }
+    }
     JvmtiEventController::set_user_enabled(this, (JavaThread*) NULL, event_type, enabled);
   } else {
     // We have a specified event_thread.
 
     JavaThread* java_thread = NULL;

@@ -3628,10 +3636,19 @@
 JvmtiEnv::GetAvailableProcessors(jint* processor_count_ptr) {
   *processor_count_ptr = os::active_processor_count();
   return JVMTI_ERROR_NONE;
 } /* end GetAvailableProcessors */
 
+jvmtiError
+JvmtiEnv::SetHeapSamplingRate(jint sampling_rate) {
+  if (sampling_rate < 0) {
+    return JVMTI_ERROR_ILLEGAL_ARGUMENT;
+  }
+  ThreadHeapSampler::set_tlab_heap_sampling(sampling_rate);
+  return JVMTI_ERROR_NONE;
+} /* end SetHeapSamplingRate */
+
   //
   // System Properties functions
   //
 
 // count_ptr - pre-checked for NULL
< prev index next >