1934 // k_mirror - may be primitive, this must be checked
1935 // heap_object_callback - pre-checked for NULL
1936 // user_data - NULL is a valid value, must be checked
1937 jvmtiError
1938 JvmtiEnv::IterateOverInstancesOfClass(oop k_mirror, jvmtiHeapObjectFilter object_filter, jvmtiHeapObjectCallback heap_object_callback, const void* user_data) {
1939 if (java_lang_Class::is_primitive(k_mirror)) {
1940 // DO PRIMITIVE CLASS PROCESSING
1941 return JVMTI_ERROR_NONE;
1942 }
1943 Klass* klass = java_lang_Class::as_Klass(k_mirror);
1944 if (klass == NULL) {
1945 return JVMTI_ERROR_INVALID_CLASS;
1946 }
1947 TraceTime t("IterateOverInstancesOfClass", TRACETIME_LOG(Debug, jvmti, objecttagging));
1948 JvmtiTagMap::tag_map_for(this)->iterate_over_heap(object_filter, klass, heap_object_callback, user_data);
1949 return JVMTI_ERROR_NONE;
1950 } /* end IterateOverInstancesOfClass */
1951
1952 // Start the sampler.
1953 jvmtiError
1954 JvmtiEnv::StartHeapSampling(jint monitoring_rate, jint max_storage) {
1955 if (monitoring_rate < 0) {
1956 return JVMTI_ERROR_ILLEGAL_ARGUMENT;
1957 }
1958
1959 HeapThreadTransition htt(Thread::current());
1960 HeapMonitoring::initialize_profiling(monitoring_rate, max_storage);
1961 return JVMTI_ERROR_NONE;
1962 } /* end StartHeapSampling */
1963
1964 // Stop the sampler.
1965 jvmtiError
1966 JvmtiEnv::StopHeapSampling() {
1967 HeapThreadTransition htt(Thread::current());
1968 HeapMonitoring::stop_profiling();
1969 return JVMTI_ERROR_NONE;
1970 } /* end StopHeapSampling */
1971
1972 // Get the currently live sampled allocations.
1973 jvmtiError
1974 JvmtiEnv::GetLiveTraces(jvmtiStackTraces* stack_traces) {
1975 HeapThreadTransition htt(Thread::current());
1976 if (stack_traces == NULL) {
1977 return JVMTI_ERROR_ILLEGAL_ARGUMENT;
1978 }
1979
1980 HeapMonitoring::get_live_traces(stack_traces);
|
1934 // k_mirror - may be primitive, this must be checked
1935 // heap_object_callback - pre-checked for NULL
1936 // user_data - NULL is a valid value, must be checked
1937 jvmtiError
1938 JvmtiEnv::IterateOverInstancesOfClass(oop k_mirror, jvmtiHeapObjectFilter object_filter, jvmtiHeapObjectCallback heap_object_callback, const void* user_data) {
1939 if (java_lang_Class::is_primitive(k_mirror)) {
1940 // DO PRIMITIVE CLASS PROCESSING
1941 return JVMTI_ERROR_NONE;
1942 }
1943 Klass* klass = java_lang_Class::as_Klass(k_mirror);
1944 if (klass == NULL) {
1945 return JVMTI_ERROR_INVALID_CLASS;
1946 }
1947 TraceTime t("IterateOverInstancesOfClass", TRACETIME_LOG(Debug, jvmti, objecttagging));
1948 JvmtiTagMap::tag_map_for(this)->iterate_over_heap(object_filter, klass, heap_object_callback, user_data);
1949 return JVMTI_ERROR_NONE;
1950 } /* end IterateOverInstancesOfClass */
1951
1952 // Start the sampler.
1953 jvmtiError
1954 JvmtiEnv::StartHeapSampling(jint monitoring_rate, jint max_gc_storage) {
1955 if (monitoring_rate < 0) {
1956 return JVMTI_ERROR_ILLEGAL_ARGUMENT;
1957 }
1958
1959 HeapThreadTransition htt(Thread::current());
1960 HeapMonitoring::initialize_profiling(monitoring_rate, max_gc_storage);
1961 return JVMTI_ERROR_NONE;
1962 } /* end StartHeapSampling */
1963
1964 // Stop the sampler.
1965 jvmtiError
1966 JvmtiEnv::StopHeapSampling() {
1967 HeapThreadTransition htt(Thread::current());
1968 HeapMonitoring::stop_profiling();
1969 return JVMTI_ERROR_NONE;
1970 } /* end StopHeapSampling */
1971
1972 // Get the currently live sampled allocations.
1973 jvmtiError
1974 JvmtiEnv::GetLiveTraces(jvmtiStackTraces* stack_traces) {
1975 HeapThreadTransition htt(Thread::current());
1976 if (stack_traces == NULL) {
1977 return JVMTI_ERROR_ILLEGAL_ARGUMENT;
1978 }
1979
1980 HeapMonitoring::get_live_traces(stack_traces);
|