877 total_committed += u.committed();
878
879 // if any one of the memory pool has undefined init_size or max_size,
880 // set it to -1
881 if (u.init_size() == (size_t)-1) {
882 has_undefined_init_size = true;
883 }
884 if (!has_undefined_init_size) {
885 total_init += u.init_size();
886 }
887
888 if (u.max_size() == (size_t)-1) {
889 has_undefined_max_size = true;
890 }
891 if (!has_undefined_max_size) {
892 total_max += u.max_size();
893 }
894 }
895 }
896
897 // In our current implementation, we make sure that all non-heap
898 // pools have defined init and max sizes. Heap pools do not matter,
899 // as we never use total_init and total_max for them.
900 assert(heap || !has_undefined_init_size, "Undefined init size");
901 assert(heap || !has_undefined_max_size, "Undefined max size");
902
903 MemoryUsage usage((heap ? InitialHeapSize : total_init),
904 total_used,
905 total_committed,
906 (heap ? Universe::heap()->max_capacity() : total_max));
907
908 Handle obj = MemoryService::create_MemoryUsage_obj(usage, CHECK_NULL);
909 return JNIHandles::make_local(env, obj());
910 JVM_END
911
912 // Returns the boolean value of a given attribute.
913 JVM_LEAF(jboolean, jmm_GetBoolAttribute(JNIEnv *env, jmmBoolAttribute att))
914 switch (att) {
915 case JMM_VERBOSE_GC:
916 return MemoryService::get_verbose();
917 case JMM_VERBOSE_CLASS:
918 return ClassLoadingService::get_verbose();
919 case JMM_THREAD_CONTENTION_MONITORING:
920 return ThreadService::is_thread_monitoring_contention();
921 case JMM_THREAD_CPU_TIME:
922 return ThreadService::is_thread_cpu_time_enabled();
|
877 total_committed += u.committed();
878
879 // if any one of the memory pool has undefined init_size or max_size,
880 // set it to -1
881 if (u.init_size() == (size_t)-1) {
882 has_undefined_init_size = true;
883 }
884 if (!has_undefined_init_size) {
885 total_init += u.init_size();
886 }
887
888 if (u.max_size() == (size_t)-1) {
889 has_undefined_max_size = true;
890 }
891 if (!has_undefined_max_size) {
892 total_max += u.max_size();
893 }
894 }
895 }
896
897 MemoryUsage usage((heap ? InitialHeapSize : total_init),
898 total_used,
899 total_committed,
900 (heap ? Universe::heap()->max_capacity() : total_max));
901
902 Handle obj = MemoryService::create_MemoryUsage_obj(usage, CHECK_NULL);
903 return JNIHandles::make_local(env, obj());
904 JVM_END
905
906 // Returns the boolean value of a given attribute.
907 JVM_LEAF(jboolean, jmm_GetBoolAttribute(JNIEnv *env, jmmBoolAttribute att))
908 switch (att) {
909 case JMM_VERBOSE_GC:
910 return MemoryService::get_verbose();
911 case JMM_VERBOSE_CLASS:
912 return ClassLoadingService::get_verbose();
913 case JMM_THREAD_CONTENTION_MONITORING:
914 return ThreadService::is_thread_monitoring_contention();
915 case JMM_THREAD_CPU_TIME:
916 return ThreadService::is_thread_cpu_time_enabled();
|