当前位置:   article > 正文

java 利用ManagementFactory获取jvm,os的一些信息_jre打印内存信息

jre打印内存信息

      想了解下某个java项目的运行时jvm的情况,可以使用一些监控工具,比如jdk的bin下就提供了很多工具。

  

比如,本地运行一个程序,让它死循环

 

  1. while(true){
  2. try {
  3. Thread.sleep(10*1000);
  4. } catch (Exception e) {
  5. }
  6. }


    然后,点击启动jconsole.exe

 

可以发现,jconsole.exe可以连接本地,也可以连接远程,我们选择本地的中的刚刚上面执行的那个类

我们发现,居然可以监控到这么多信息,那如果我们自己写代码,能否获取到这些信息呢,点击MBean。

java.lang下,看名称就知道是什么了,再点击某一个,会看到一些类信息,也就是说,我们是有可能自己写代码也能获取到jvm信息的。

    下面就记录下例子代码。

 

 

  1. package com.fei;
  2. import java.lang.management.ClassLoadingMXBean;
  3. import java.lang.management.CompilationMXBean;
  4. import java.lang.management.GarbageCollectorMXBean;
  5. import java.lang.management.ManagementFactory;
  6. import java.lang.management.MemoryMXBean;
  7. import java.lang.management.MemoryManagerMXBean;
  8. import java.lang.management.MemoryPoolMXBean;
  9. import java.lang.management.MemoryUsage;
  10. import java.lang.management.OperatingSystemMXBean;
  11. import java.lang.management.RuntimeMXBean;
  12. import java.lang.management.ThreadInfo;
  13. import java.lang.management.ThreadMXBean;
  14. import java.lang.reflect.InvocationTargetException;
  15. import java.lang.reflect.Method;
  16. import java.util.Arrays;
  17. import java.util.List;
  18. public class JvmInfo {
  19. static final long MB = 1024 * 1024;
  20. public static void main(String[] args) {
  21. //打印系统信息
  22. System.out.println("===========打印系统信息==========");
  23. printOperatingSystemInfo();
  24. //打印编译信息
  25. System.out.println("===========打印编译信息==========");
  26. printCompilationInfo();
  27. //打印类加载信息
  28. System.out.println("===========打印类加载信息==========");
  29. printClassLoadingInfo();
  30. //打印运行时信息
  31. System.out.println("===========打印运行时信息==========");
  32. printRuntimeInfo();
  33. //打印内存管理器信息
  34. System.out.println("===========打印内存管理器信息==========");
  35. printMemoryManagerInfo();
  36. //打印垃圾回收信息
  37. System.out.println("===========打印垃圾回收信息==========");
  38. printGarbageCollectorInfo();
  39. //打印vm内存
  40. System.out.println("===========打印vm内存信息==========");
  41. printMemoryInfo();
  42. //打印vm各内存区信息
  43. System.out.println("===========打印vm各内存区信息==========");
  44. printMemoryPoolInfo();
  45. //打印线程信息
  46. System.out.println("===========打印线程==========");
  47. printThreadInfo();
  48. }
  49. private static void printOperatingSystemInfo(){
  50. OperatingSystemMXBean system = ManagementFactory.getOperatingSystemMXBean();
  51. //相当于System.getProperty("os.name").
  52. System.out.println("系统名称:"+system.getName());
  53. //相当于System.getProperty("os.version").
  54. System.out.println("系统版本:"+system.getVersion());
  55. //相当于System.getProperty("os.arch").
  56. System.out.println("操作系统的架构:"+system.getArch());
  57. //相当于 Runtime.availableProcessors()
  58. System.out.println("可用的内核数:"+system.getAvailableProcessors());
  59. if(isSunOsMBean(system)){
  60. long totalPhysicalMemory = getLongFromOperatingSystem(system,"getTotalPhysicalMemorySize");
  61. long freePhysicalMemory = getLongFromOperatingSystem(system, "getFreePhysicalMemorySize");
  62. long usedPhysicalMemorySize =totalPhysicalMemory - freePhysicalMemory;
  63. System.out.println("总物理内存(M):"+totalPhysicalMemory/MB);
  64. System.out.println("已用物理内存(M):"+usedPhysicalMemorySize/MB);
  65. System.out.println("剩余物理内存(M):"+freePhysicalMemory/MB);
  66. long totalSwapSpaceSize = getLongFromOperatingSystem(system, "getTotalSwapSpaceSize");
  67. long freeSwapSpaceSize = getLongFromOperatingSystem(system, "getFreeSwapSpaceSize");
  68. long usedSwapSpaceSize = totalSwapSpaceSize - freeSwapSpaceSize;
  69. System.out.println("总交换空间(M):"+totalSwapSpaceSize/MB);
  70. System.out.println("已用交换空间(M):"+usedSwapSpaceSize/MB);
  71. System.out.println("剩余交换空间(M):"+freeSwapSpaceSize/MB);
  72. }
  73. }
  74. private static long getLongFromOperatingSystem(OperatingSystemMXBean operatingSystem, String methodName) {
  75. try {
  76. final Method method = operatingSystem.getClass().getMethod(methodName,
  77. (Class<?>[]) null);
  78. method.setAccessible(true);
  79. return (Long) method.invoke(operatingSystem, (Object[]) null);
  80. } catch (final InvocationTargetException e) {
  81. if (e.getCause() instanceof Error) {
  82. throw (Error) e.getCause();
  83. } else if (e.getCause() instanceof RuntimeException) {
  84. throw (RuntimeException) e.getCause();
  85. }
  86. throw new IllegalStateException(e.getCause());
  87. } catch (final NoSuchMethodException e) {
  88. throw new IllegalArgumentException(e);
  89. } catch (final IllegalAccessException e) {
  90. throw new IllegalStateException(e);
  91. }
  92. }
  93. private static void printCompilationInfo(){
  94. CompilationMXBean compilation = ManagementFactory.getCompilationMXBean();
  95. System.out.println("JIT编译器名称:"+compilation.getName());
  96. //判断jvm是否支持编译时间的监控
  97. if(compilation.isCompilationTimeMonitoringSupported()){
  98. System.out.println("总编译时间:"+compilation.getTotalCompilationTime()+"秒");
  99. }
  100. }
  101. private static void printClassLoadingInfo(){
  102. ClassLoadingMXBean classLoad= ManagementFactory.getClassLoadingMXBean();
  103. System.out.println("已加载类总数:"+classLoad.getTotalLoadedClassCount());
  104. System.out.println("已加载当前类:"+classLoad.getLoadedClassCount());
  105. System.out.println("已卸载类总数:"+classLoad.getUnloadedClassCount());
  106. }
  107. private static void printRuntimeInfo(){
  108. RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
  109. System.out.println("进程PID="+runtime.getName().split("@")[0]);
  110. System.out.println("jvm规范名称:"+runtime.getSpecName());
  111. System.out.println("jvm规范运营商:"+runtime.getSpecVendor());
  112. System.out.println("jvm规范版本:"+runtime.getSpecVersion());
  113. //返回虚拟机在毫秒内的开始时间。该方法返回了虚拟机启动时的近似时间
  114. System.out.println("jvm启动时间(毫秒):"+runtime.getStartTime());
  115. //相当于System.getProperties
  116. System.out.println("获取System.properties:"+runtime.getSystemProperties());
  117. System.out.println("jvm正常运行时间(毫秒):"+runtime.getUptime());
  118. //相当于System.getProperty("java.vm.name").
  119. System.out.println("jvm名称:"+runtime.getVmName());
  120. //相当于System.getProperty("java.vm.vendor").
  121. System.out.println("jvm运营商:"+runtime.getVmVendor());
  122. //相当于System.getProperty("java.vm.version").
  123. System.out.println("jvm实现版本:"+runtime.getVmVersion());
  124. List<String> args = runtime.getInputArguments();
  125. if(args != null && !args.isEmpty()){
  126. System.out.println("vm参数:");
  127. for(String arg : args){
  128. System.out.println(arg);
  129. }
  130. }
  131. System.out.println("类路径:"+runtime.getClassPath());
  132. System.out.println("引导类路径:"+runtime.getBootClassPath());
  133. System.out.println("库路径:"+runtime.getLibraryPath());
  134. }
  135. private static void printMemoryManagerInfo(){
  136. List<MemoryManagerMXBean> managers = ManagementFactory.getMemoryManagerMXBeans();
  137. if(managers != null && !managers.isEmpty()){
  138. for(MemoryManagerMXBean manager : managers){
  139. System.out.println("vm内存管理器:名称="+manager.getName()+",管理的内存区="
  140. +Arrays.deepToString(manager.getMemoryPoolNames())+",ObjectName="+manager.getObjectName());
  141. }
  142. }
  143. }
  144. private static void printGarbageCollectorInfo(){
  145. List<GarbageCollectorMXBean> garbages = ManagementFactory.getGarbageCollectorMXBeans();
  146. for(GarbageCollectorMXBean garbage : garbages){
  147. System.out.println("垃圾收集器:名称="+garbage.getName()+",收集="+garbage.getCollectionCount()+",总花费时间="
  148. +garbage.getCollectionTime()+",内存区名称="+Arrays.deepToString(garbage.getMemoryPoolNames()));
  149. }
  150. }
  151. private static void printMemoryInfo(){
  152. MemoryMXBean memory = ManagementFactory.getMemoryMXBean();
  153. MemoryUsage headMemory = memory.getHeapMemoryUsage();
  154. System.out.println("head堆:");
  155. System.out.println("\t初始(M):"+headMemory.getInit()/MB);
  156. System.out.println("\t最大(上限)(M):"+headMemory.getMax()/MB);
  157. System.out.println("\t当前(已使用)(M):"+headMemory.getUsed()/MB);
  158. System.out.println("\t提交的内存(已申请)(M):"+headMemory.getCommitted()/MB);
  159. System.out.println("\t使用率:"+headMemory.getUsed()*100/headMemory.getCommitted()+"%");
  160. System.out.println("non-head非堆:");
  161. MemoryUsage nonheadMemory = memory.getNonHeapMemoryUsage();
  162. System.out.println("\t初始(M):"+nonheadMemory.getInit()/MB);
  163. System.out.println("\t最大(上限)(M):"+nonheadMemory.getMax()/MB);
  164. System.out.println("\t当前(已使用)(M):"+nonheadMemory.getUsed()/MB);
  165. System.out.println("\t提交的内存(已申请)(M):"+nonheadMemory.getCommitted()/MB);
  166. System.out.println("\t使用率:"+nonheadMemory.getUsed()*100/nonheadMemory.getCommitted()+"%");
  167. }
  168. private static void printMemoryPoolInfo(){
  169. List<MemoryPoolMXBean> pools = ManagementFactory.getMemoryPoolMXBeans();
  170. if(pools != null && !pools.isEmpty()){
  171. for(MemoryPoolMXBean pool : pools){
  172. //只打印一些各个内存区都有的属性,一些区的特殊属性,可看文档或百度
  173. //最大值,初始值,如果没有定义的话,返回-1,所以真正使用时,要注意
  174. System.out.println("vm内存区:\n\t名称="+pool.getName()+"\n\t所属内存管理者="+Arrays.deepToString(pool.getMemoryManagerNames())
  175. +"\n\t ObjectName="+pool.getObjectName()+"\n\t初始大小(M)="+pool.getUsage().getInit()/MB
  176. +"\n\t最大(上限)(M)="+pool.getUsage().getMax()/MB
  177. +"\n\t已用大小(M)="+pool.getUsage().getUsed()/MB
  178. +"\n\t已提交(已申请)(M)="+pool.getUsage().getCommitted()/MB
  179. +"\n\t使用率="+(pool.getUsage().getUsed()*100/pool.getUsage().getCommitted())+"%");
  180. }
  181. }
  182. }
  183. private static void printThreadInfo(){
  184. ThreadMXBean thread = ManagementFactory.getThreadMXBean();
  185. System.out.println("ObjectName="+thread.getObjectName());
  186. System.out.println("仍活动的线程总数="+thread.getThreadCount());
  187. System.out.println("峰值="+thread.getPeakThreadCount());
  188. System.out.println("线程总数(被创建并执行过的线程总数)="+thread.getTotalStartedThreadCount());
  189. System.out.println("当初仍活动的守护线程(daemonThread)总数="+thread.getDaemonThreadCount());
  190. //检查是否有死锁的线程存在
  191. long[] deadlockedIds = thread.findDeadlockedThreads();
  192. if(deadlockedIds != null && deadlockedIds.length > 0){
  193. ThreadInfo[] deadlockInfos = thread.getThreadInfo(deadlockedIds);
  194. System.out.println("死锁线程信息:");
  195. System.out.println("\t\t线程名称\t\t状态\t\t");
  196. for(ThreadInfo deadlockInfo : deadlockInfos){
  197. System.out.println("\t\t"+deadlockInfo.getThreadName()+"\t\t"+deadlockInfo.getThreadState()
  198. +"\t\t"+deadlockInfo.getBlockedTime()+"\t\t"+deadlockInfo.getWaitedTime()
  199. +"\t\t"+deadlockInfo.getStackTrace().toString());
  200. }
  201. }
  202. long[] threadIds = thread.getAllThreadIds();
  203. if(threadIds != null && threadIds.length > 0){
  204. ThreadInfo[] threadInfos = thread.getThreadInfo(threadIds);
  205. System.out.println("所有线程信息:");
  206. System.out.println("\t\t线程名称\t\t\t\t\t状态\t\t\t\t\t线程id");
  207. for(ThreadInfo threadInfo : threadInfos){
  208. System.out.println("\t\t"+threadInfo.getThreadName()+"\t\t\t\t\t"+threadInfo.getThreadState()
  209. +"\t\t\t\t\t"+threadInfo.getThreadId());
  210. }
  211. }
  212. }
  213. private static boolean isSunOsMBean(OperatingSystemMXBean operatingSystem) {
  214. final String className = operatingSystem.getClass().getName();
  215. return "com.sun.management.OperatingSystem".equals(className)
  216. || "com.sun.management.UnixOperatingSystem".equals(className)
  217. || "sun.management.OperatingSystemImpl".equals(className);
  218. }
  219. }

 

===========打印系统信息==========
系统名称:Windows 7
系统版本:6.1
操作系统的架构:amd64
可用的内核数:4
总物理内存(M):6041
已用物理内存(M):5387
剩余物理内存(M):653
总交换空间(M):18136
已用交换空间(M):15817
剩余交换空间(M):2319
===========打印编译信息==========
JIT编译器名称:HotSpot 64-Bit Tiered Compilers
总编译时间:0===========打印类加载信息==========
已加载类总数:410
已加载当前类:410
已卸载类总数:0
===========打印运行时信息==========
进程PID=386220
jvm规范名称:Java Virtual Machine Specification
jvm规范运营商:Oracle Corporation
jvm规范版本:1.7
jvm启动时间(毫秒):1447134405258
获取System.properties:{java.vm.version=24.80-b11, sun.jnu.encoding=GBK, java.vendor.url=http://java.oracle.com/, java.vm.info=mixed mode, user.dir=E:\test2\test200, sun.cpu.isalist=amd64, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, sun.os.patch.level=Service Pack 1, java.io.tmpdir=C:\Users\WEIJIA~1\AppData\Local\Temp\, user.home=E:\USER\weijianfei, java.awt.printerjob=sun.awt.windows.WPrinterJob, java.version=1.7.0_80, file.encoding.pkg=sun.io, java.vendor.url.bug=http://bugreport.sun.com/bugreport/, file.encoding=UTF-8, line.separator=
, sun.java.command=com.fei.JvmInfo, java.vm.specification.vendor=Oracle Corporation, java.vm.vendor=Oracle Corporation, java.class.path=E:\test2\test200\target\classes;E:\setup\maven\org\apache\zookeeper\zookeeper\3.4.6\zookeeper-3.4.6.jar;E:\setup\maven\org\slf4j\slf4j-api\1.6.1\slf4j-api-1.6.1.jar;E:\setup\maven\org\slf4j\slf4j-log4j12\1.6.1\slf4j-log4j12-1.6.1.jar;E:\setup\maven\log4j\log4j\1.2.16\log4j-1.2.16.jar;E:\setup\maven\jline\jline\0.9.94\jline-0.9.94.jar;E:\setup\maven\junit\junit\3.8.1\junit-3.8.1.jar;E:\setup\maven\io\netty\netty\3.7.0.Final\netty-3.7.0.Final.jar;E:\setup\maven\org\springframework\spring-webmvc\4.2.1.RELEASE\spring-webmvc-4.2.1.RELEASE.jar;E:\setup\maven\org\springframework\spring-beans\4.2.1.RELEASE\spring-beans-4.2.1.RELEASE.jar;E:\setup\maven\org\springframework\spring-context\4.2.1.RELEASE\spring-context-4.2.1.RELEASE.jar;E:\setup\maven\org\springframework\spring-aop\4.2.1.RELEASE\spring-aop-4.2.1.RELEASE.jar;E:\setup\maven\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;E:\setup\maven\org\springframework\spring-core\4.2.1.RELEASE\spring-core-4.2.1.RELEASE.jar;E:\setup\maven\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;E:\setup\maven\org\springframework\spring-expression\4.2.1.RELEASE\spring-expression-4.2.1.RELEASE.jar;E:\setup\maven\org\springframework\spring-web\4.2.1.RELEASE\spring-web-4.2.1.RELEASE.jar, sun.io.unicode.encoding=UnicodeLittle, user.variant=, os.arch=amd64, user.name=weijianfei, user.language=zh, java.runtime.version=1.7.0_80-b15, sun.boot.class.path=D:\jre1.7\lib\resources.jar;D:\jre1.7\lib\rt.jar;D:\jre1.7\lib\sunrsasign.jar;D:\jre1.7\lib\jsse.jar;D:\jre1.7\lib\jce.jar;D:\jre1.7\lib\charsets.jar;D:\jre1.7\lib\jfr.jar;D:\jre1.7\classes, sun.desktop=windows, sun.cpu.endian=little, awt.toolkit=sun.awt.windows.WToolkit, sun.boot.library.path=D:\jre1.7\bin, java.vm.name=Java HotSpot(TM) 64-Bit Server VM, java.home=D:\jre1.7, java.endorsed.dirs=D:\jre1.7\lib\endorsed, sun.management.compiler=HotSpot 64-Bit Tiered Compilers, java.runtime.name=Java(TM) SE Runtime Environment, java.library.path=D:\jre1.7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.6.0_45\bin;C:\Program Files\Java\jdk1.6.0_45\jre\bin;D:\soft\svn1.8\bin;D:\apache-maven-3.2.3\bin;D:\mysql5.7\MySQL Server 5.7\bin;D:\mysql5.7\MySQL Utilities 1.3.5\;D:\mongoDB;., file.separator=\, java.specification.vendor=Oracle Corporation, java.vm.specification.version=1.7, sun.java.launcher=SUN_STANDARD, user.timezone=, os.name=Windows 7, path.separator=;, java.ext.dirs=D:\jre1.7\lib\ext;C:\Windows\Sun\Java\lib\ext, sun.arch.data.model=64, java.specification.name=Java Platform API Specification, os.version=6.1, user.script=, user.country=CN, java.class.version=51.0, java.vendor=Oracle Corporation, java.vm.specification.name=Java Virtual Machine Specification, java.specification.version=1.7}
jvm正常运行时间(毫秒):573
jvm名称:Java HotSpot(TM) 64-Bit Server VM
jvm运营商:Oracle Corporation
jvm实现版本:24.80-b11
vm参数:
-Dfile.encoding=UTF-8
类路径:E:\test2\test200\target\classes;E:\setup\maven\org\apache\zookeeper\zookeeper\3.4.6\zookeeper-3.4.6.jar;E:\setup\maven\org\slf4j\slf4j-api\1.6.1\slf4j-api-1.6.1.jar;E:\setup\maven\org\slf4j\slf4j-log4j12\1.6.1\slf4j-log4j12-1.6.1.jar;E:\setup\maven\log4j\log4j\1.2.16\log4j-1.2.16.jar;E:\setup\maven\jline\jline\0.9.94\jline-0.9.94.jar;E:\setup\maven\junit\junit\3.8.1\junit-3.8.1.jar;E:\setup\maven\io\netty\netty\3.7.0.Final\netty-3.7.0.Final.jar;E:\setup\maven\org\springframework\spring-webmvc\4.2.1.RELEASE\spring-webmvc-4.2.1.RELEASE.jar;E:\setup\maven\org\springframework\spring-beans\4.2.1.RELEASE\spring-beans-4.2.1.RELEASE.jar;E:\setup\maven\org\springframework\spring-context\4.2.1.RELEASE\spring-context-4.2.1.RELEASE.jar;E:\setup\maven\org\springframework\spring-aop\4.2.1.RELEASE\spring-aop-4.2.1.RELEASE.jar;E:\setup\maven\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;E:\setup\maven\org\springframework\spring-core\4.2.1.RELEASE\spring-core-4.2.1.RELEASE.jar;E:\setup\maven\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;E:\setup\maven\org\springframework\spring-expression\4.2.1.RELEASE\spring-expression-4.2.1.RELEASE.jar;E:\setup\maven\org\springframework\spring-web\4.2.1.RELEASE\spring-web-4.2.1.RELEASE.jar
引导类路径:D:\jre1.7\lib\resources.jar;D:\jre1.7\lib\rt.jar;D:\jre1.7\lib\sunrsasign.jar;D:\jre1.7\lib\jsse.jar;D:\jre1.7\lib\jce.jar;D:\jre1.7\lib\charsets.jar;D:\jre1.7\lib\jfr.jar;D:\jre1.7\classes
库路径:D:\jre1.7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.6.0_45\bin;C:\Program Files\Java\jdk1.6.0_45\jre\bin;D:\soft\svn1.8\bin;D:\apache-maven-3.2.3\bin;D:\mysql5.7\MySQL Server 5.7\bin;D:\mysql5.7\MySQL Utilities 1.3.5\;D:\mongoDB;.
===========打印内存管理器信息==========
vm内存管理器:名称=CodeCacheManager,管理的内存区=[Code Cache],ObjectName=java.lang:type=MemoryManager,name=CodeCacheManager
vm内存管理器:名称=PS Scavenge,管理的内存区=[PS Eden Space, PS Survivor Space],ObjectName=java.lang:type=GarbageCollector,name=PS Scavenge
vm内存管理器:名称=PS MarkSweep,管理的内存区=[PS Eden Space, PS Survivor Space, PS Old Gen, PS Perm Gen],ObjectName=java.lang:type=GarbageCollector,name=PS MarkSweep
===========打印垃圾回收信息==========
垃圾收集器:名称=PS Scavenge,收集=0,总花费时间=0,内存区名称=[PS Eden Space, PS Survivor Space]
垃圾收集器:名称=PS MarkSweep,收集=0,总花费时间=0,内存区名称=[PS Eden Space, PS Survivor Space, PS Old Gen, PS Perm Gen]
===========打印vm内存信息==========
head堆:
	初始(M):94
	最大(上限)(M):1344
	当前(已使用)(M):1
	提交的内存(已申请)(M):91
	使用率:1%
non-head非堆:
	初始(M):23
	最大(上限)(M):130
	当前(已使用)(M):3
	提交的内存(已申请)(M):23
	使用率:13%
===========打印vm各内存区信息==========
vm内存区:
	名称=Code Cache
	所属内存管理者=[CodeCacheManager]
	 ObjectName=java.lang:type=MemoryPool,name=Code Cache
	初始大小(M)=2
	最大(上限)(M)=48
	已用大小(M)=0
	已提交(已申请)(M)=2
	使用率=15%
vm内存区:
	名称=PS Eden Space
	所属内存管理者=[PS MarkSweep, PS Scavenge]
	 ObjectName=java.lang:type=MemoryPool,name=PS Eden Space
	初始大小(M)=24
	最大(上限)(M)=497
	已用大小(M)=1
	已提交(已申请)(M)=24
	使用率=6%
vm内存区:
	名称=PS Survivor Space
	所属内存管理者=[PS MarkSweep, PS Scavenge]
	 ObjectName=java.lang:type=MemoryPool,name=PS Survivor Space
	初始大小(M)=3
	最大(上限)(M)=3
	已用大小(M)=0
	已提交(已申请)(M)=3
	使用率=0%
vm内存区:
	名称=PS Old Gen
	所属内存管理者=[PS MarkSweep]
	 ObjectName=java.lang:type=MemoryPool,name=PS Old Gen
	初始大小(M)=63
	最大(上限)(M)=1008
	已用大小(M)=0
	已提交(已申请)(M)=63
	使用率=0%
vm内存区:
	名称=PS Perm Gen
	所属内存管理者=[PS MarkSweep]
	 ObjectName=java.lang:type=MemoryPool,name=PS Perm Gen
	初始大小(M)=21
	最大(上限)(M)=82
	已用大小(M)=2
	已提交(已申请)(M)=21
	使用率=13%
===========打印线程==========
ObjectName=java.lang:type=Threading
仍活动的线程总数=5
峰值=5
线程总数(被创建并执行过的线程总数)=5
当初仍活动的守护线程(daemonThread)总数=4
所有线程信息:
		线程名称					状态					线程id
		Attach Listener					RUNNABLE					5
		Signal Dispatcher					RUNNABLE					4
		Finalizer					WAITING					3
		Reference Handler					WAITING					2
		main					RUNNABLE					1

 

 

 

 

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/372250?site
推荐阅读
相关标签
  

闽ICP备14008679号