743 has_undefined_max_size = true;
744 }
745 if (!has_undefined_max_size) {
746 total_max += u.max_size();
747 }
748 }
749 }
750
751 // if any one of the memory pool has undefined init_size or max_size,
752 // set it to -1
753 if (has_undefined_init_size) {
754 total_init = (size_t)-1;
755 }
756 if (has_undefined_max_size) {
757 total_max = (size_t)-1;
758 }
759
760 MemoryUsage usage((heap ? InitialHeapSize : total_init),
761 total_used,
762 total_committed,
763 (heap ? Universe::heap()->max_capacity() : total_max));
764
765 Handle obj = MemoryService::create_MemoryUsage_obj(usage, CHECK_NULL);
766 return JNIHandles::make_local(env, obj());
767 JVM_END
768
769 // Returns the boolean value of a given attribute.
770 JVM_LEAF(jboolean, jmm_GetBoolAttribute(JNIEnv *env, jmmBoolAttribute att))
771 switch (att) {
772 case JMM_VERBOSE_GC:
773 return MemoryService::get_verbose();
774 case JMM_VERBOSE_CLASS:
775 return ClassLoadingService::get_verbose();
776 case JMM_THREAD_CONTENTION_MONITORING:
777 return ThreadService::is_thread_monitoring_contention();
778 case JMM_THREAD_CPU_TIME:
779 return ThreadService::is_thread_cpu_time_enabled();
780 case JMM_THREAD_ALLOCATED_MEMORY:
781 return ThreadService::is_thread_allocated_memory_enabled();
782 default:
783 assert(0, "Unrecognized attribute");
|
743 has_undefined_max_size = true;
744 }
745 if (!has_undefined_max_size) {
746 total_max += u.max_size();
747 }
748 }
749 }
750
751 // if any one of the memory pool has undefined init_size or max_size,
752 // set it to -1
753 if (has_undefined_init_size) {
754 total_init = (size_t)-1;
755 }
756 if (has_undefined_max_size) {
757 total_max = (size_t)-1;
758 }
759
760 MemoryUsage usage((heap ? InitialHeapSize : total_init),
761 total_used,
762 total_committed,
763 (heap ? GC::gc()->heap()->max_capacity() : total_max));
764
765 Handle obj = MemoryService::create_MemoryUsage_obj(usage, CHECK_NULL);
766 return JNIHandles::make_local(env, obj());
767 JVM_END
768
769 // Returns the boolean value of a given attribute.
770 JVM_LEAF(jboolean, jmm_GetBoolAttribute(JNIEnv *env, jmmBoolAttribute att))
771 switch (att) {
772 case JMM_VERBOSE_GC:
773 return MemoryService::get_verbose();
774 case JMM_VERBOSE_CLASS:
775 return ClassLoadingService::get_verbose();
776 case JMM_THREAD_CONTENTION_MONITORING:
777 return ThreadService::is_thread_monitoring_contention();
778 case JMM_THREAD_CPU_TIME:
779 return ThreadService::is_thread_cpu_time_enabled();
780 case JMM_THREAD_ALLOCATED_MEMORY:
781 return ThreadService::is_thread_allocated_memory_enabled();
782 default:
783 assert(0, "Unrecognized attribute");
|