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