< prev index next >
src/share/vm/prims/jvmtiEnv.cpp
Print this page
@@ -44,19 +44,21 @@
#include "prims/jvmtiAgentThread.hpp"
#include "prims/jvmtiClassFileReconstituter.hpp"
#include "prims/jvmtiCodeBlobEvents.hpp"
#include "prims/jvmtiExtensions.hpp"
#include "prims/jvmtiGetLoadedClasses.hpp"
+#include "prims/jvmtiHeapTransition.hpp"
#include "prims/jvmtiImpl.hpp"
#include "prims/jvmtiManageCapabilities.hpp"
#include "prims/jvmtiRawMonitor.hpp"
#include "prims/jvmtiRedefineClasses.hpp"
#include "prims/jvmtiTagMap.hpp"
#include "prims/jvmtiThreadState.inline.hpp"
#include "prims/jvmtiUtil.hpp"
#include "runtime/arguments.hpp"
#include "runtime/deoptimization.hpp"
+#include "runtime/heapMonitoring.hpp"
#include "runtime/interfaceSupport.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/jfieldIDWorkaround.hpp"
#include "runtime/osThread.hpp"
#include "runtime/reflectionUtils.hpp"
@@ -1945,10 +1947,75 @@
TraceTime t("IterateOverInstancesOfClass", TRACETIME_LOG(Debug, jvmti, objecttagging));
JvmtiTagMap::tag_map_for(this)->iterate_over_heap(object_filter, klass, heap_object_callback, user_data);
return JVMTI_ERROR_NONE;
} /* end IterateOverInstancesOfClass */
+// Start the sampler.
+jvmtiError
+JvmtiEnv::StartHeapSampling(jint monitoring_rate, jint max_storage) {
+ if (monitoring_rate < 0) {
+ return JVMTI_ERROR_ILLEGAL_ARGUMENT;
+ }
+
+ HeapThreadTransition htt(Thread::current());
+ HeapMonitoring::initialize_profiling(monitoring_rate, max_storage);
+ return JVMTI_ERROR_NONE;
+} /* end StartHeapSampling */
+
+// Stop the sampler.
+jvmtiError
+JvmtiEnv::StopHeapSampling() {
+ HeapThreadTransition htt(Thread::current());
+ HeapMonitoring::stop_profiling();
+ return JVMTI_ERROR_NONE;
+} /* end StopHeapSampling */
+
+// Get the currently live sampled allocations.
+jvmtiError
+JvmtiEnv::GetLiveTraces(jvmtiStackTraces *stack_traces) {
+ HeapThreadTransition htt(Thread::current());
+ if (stack_traces == NULL) {
+ return JVMTI_ERROR_ILLEGAL_ARGUMENT;
+ }
+
+ HeapMonitoring::get_live_traces(stack_traces);
+ return JVMTI_ERROR_NONE;
+} /* end GetLiveTraces */
+
+// Get the currently live sampled allocations.
+jvmtiError
+JvmtiEnv::GetGarbageTraces(jvmtiStackTraces *stack_traces) {
+ HeapThreadTransition htt(Thread::current());
+ if (stack_traces == NULL) {
+ return JVMTI_ERROR_ILLEGAL_ARGUMENT;
+ }
+
+ HeapMonitoring::get_garbage_traces(stack_traces);
+ return JVMTI_ERROR_NONE;
+} /* end GetGarbageTraces */
+
+// Get the currently live sampled allocations.
+jvmtiError
+JvmtiEnv::GetFrequentGarbageTraces(jvmtiStackTraces *stack_traces) {
+ HeapThreadTransition htt(Thread::current());
+ if (stack_traces == NULL) {
+ return JVMTI_ERROR_ILLEGAL_ARGUMENT;
+ }
+
+ HeapMonitoring::get_frequent_garbage_traces(stack_traces);
+ return JVMTI_ERROR_NONE;
+} /* end GetFrequentGarbageTraces */
+
+// Release sampled traces.
+jvmtiError
+JvmtiEnv::ReleaseTraces(jvmtiStackTraces *stack_traces) {
+ if (stack_traces == NULL) {
+ return JVMTI_ERROR_NONE;
+ }
+ HeapMonitoring::release_traces(stack_traces);
+ return JVMTI_ERROR_NONE;
+} /* end ReleaseTraces */
//
// Local Variable functions
//
< prev index next >