List of usage examples for java.lang.management MemoryMXBean getNonHeapMemoryUsage
public MemoryUsage getNonHeapMemoryUsage();
From source file:org.rhq.enterprise.agent.promptcmd.GCPromptCommand.java
private void printGlobalMemoryUsage(PrintWriter out, final MemoryMXBean memoryMxBean) { printMemoryUsage(out, "GLOBAL", MemoryType.HEAP, memoryMxBean.getHeapMemoryUsage()); printMemoryUsage(out, "GLOBAL", MemoryType.NON_HEAP, memoryMxBean.getNonHeapMemoryUsage()); }
From source file:org.romaframework.core.config.RomaApplicationContext.java
private void logMemoryUsage() { MemoryMXBean memBean = ManagementFactory.getMemoryMXBean(); MemoryUsage heapMemory = memBean.getHeapMemoryUsage(); MemoryUsage nonHeapMemory = memBean.getNonHeapMemoryUsage(); NumberFormat nf = NumberFormat.getInstance(); log.info("--------------- MEMORY USAGE ---------------"); log.info("HEAP INIT MEMORY: " + nf.format(heapMemory.getInit()) + " bytes"); log.info("HEAP USED MEMORY: " + nf.format(heapMemory.getUsed()) + " bytes"); log.info("HEAP COMMITTED MEMORY: " + nf.format(heapMemory.getCommitted()) + " bytes"); log.info("HEAP MAX MEMORY: " + nf.format(heapMemory.getMax()) + " bytes"); log.info(" "); log.info("NON HEAP INIT MEMORY: " + nf.format(nonHeapMemory.getInit()) + " bytes"); log.info("NON HEAP USED MEMORY: " + nf.format(nonHeapMemory.getUsed()) + " bytes"); log.info("NON HEAP COMMITTED MEMORY: " + nf.format(nonHeapMemory.getCommitted()) + " bytes"); log.info("NON HEAP MAX MEMORY: " + nf.format(nonHeapMemory.getMax()) + " bytes"); log.info("--------------------------------------------"); }
From source file:ro.nextreports.server.web.debug.InfoUtil.java
public static List<Info> getGeneralJVMInfo() { List<Info> infos = new ArrayList<Info>(); RuntimeMXBean runtimeBean = ManagementFactory.getRuntimeMXBean(); infos.add(new Info("uptime", "" + Duration.milliseconds(runtimeBean.getUptime()).toString())); infos.add(new Info("name", runtimeBean.getName())); infos.add(new Info("pid", runtimeBean.getName().split("@")[0])); OperatingSystemMXBean systemBean = ManagementFactory.getOperatingSystemMXBean(); infos.add(new Info("os name", "" + systemBean.getName())); infos.add(new Info("os version", "" + systemBean.getVersion())); infos.add(new Info("system load average", "" + systemBean.getSystemLoadAverage())); infos.add(new Info("available processors", "" + systemBean.getAvailableProcessors())); ThreadMXBean threadBean = ManagementFactory.getThreadMXBean(); infos.add(new Info("thread count", "" + threadBean.getThreadCount())); infos.add(new Info("peak thread count", "" + threadBean.getPeakThreadCount())); MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean(); infos.add(new Info("heap memory used", FileUtils.byteCountToDisplaySize(memoryBean.getHeapMemoryUsage().getUsed()))); infos.add(new Info("non-heap memory used", FileUtils.byteCountToDisplaySize(memoryBean.getNonHeapMemoryUsage().getUsed()))); return infos; }