Java Code Examples for com.sun.management.GarbageCollectorMXBean#getLastGcInfo()
The following examples show how to use
com.sun.management.GarbageCollectorMXBean#getLastGcInfo() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MonitorLiveSetSize.java From java-svc with BSD 3-Clause "New" or "Revised" License | 5 votes |
private static void printLastGCInfo(GarbageCollectorMXBean mBean) { GcInfo lastGcInfo = mBean.getLastGcInfo(); for (Entry<String, MemoryUsage> usage : lastGcInfo.getMemoryUsageAfterGc().entrySet()) { System.out.println(String.format("%-25s\tused=%9d kB\tmax=%9d kB", usage.getKey() + ":", toKB(usage.getValue().getUsed()), toKB(usage.getValue().getMax()))); } }
Example 2
Source File: MemoryPoolProxy.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
public MemoryPoolStat getStat() throws java.io.IOException { long usageThreshold = (pool.isUsageThresholdSupported() ? pool.getUsageThreshold() : -1); long collectThreshold = (pool.isCollectionUsageThresholdSupported() ? pool.getCollectionUsageThreshold() : -1); long lastGcStartTime = 0; long lastGcEndTime = 0; MemoryUsage beforeGcUsage = null; MemoryUsage afterGcUsage = null; long gcId = 0; if (lastGcInfo != null) { gcId = lastGcInfo.getId(); lastGcStartTime = lastGcInfo.getStartTime(); lastGcEndTime = lastGcInfo.getEndTime(); beforeGcUsage = lastGcInfo.getMemoryUsageBeforeGc().get(poolName); afterGcUsage = lastGcInfo.getMemoryUsageAfterGc().get(poolName); } Set<Map.Entry<ObjectName,Long>> set = gcMBeans.entrySet(); for (Map.Entry<ObjectName,Long> e : set) { GarbageCollectorMXBean gc = client.getMXBean(e.getKey(), com.sun.management.GarbageCollectorMXBean.class); Long gcCount = e.getValue(); Long newCount = gc.getCollectionCount(); if (newCount > gcCount) { gcMBeans.put(e.getKey(), new Long(newCount)); lastGcInfo = gc.getLastGcInfo(); if (lastGcInfo.getEndTime() > lastGcEndTime) { gcId = lastGcInfo.getId(); lastGcStartTime = lastGcInfo.getStartTime(); lastGcEndTime = lastGcInfo.getEndTime(); beforeGcUsage = lastGcInfo.getMemoryUsageBeforeGc().get(poolName); afterGcUsage = lastGcInfo.getMemoryUsageAfterGc().get(poolName); assert(beforeGcUsage != null); assert(afterGcUsage != null); } } } MemoryUsage usage = pool.getUsage(); return new MemoryPoolStat(poolName, usageThreshold, usage, gcId, lastGcStartTime, lastGcEndTime, collectThreshold, beforeGcUsage, afterGcUsage); }
Example 3
Source File: MemoryPoolProxy.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public MemoryPoolStat getStat() throws java.io.IOException { long usageThreshold = (pool.isUsageThresholdSupported() ? pool.getUsageThreshold() : -1); long collectThreshold = (pool.isCollectionUsageThresholdSupported() ? pool.getCollectionUsageThreshold() : -1); long lastGcStartTime = 0; long lastGcEndTime = 0; MemoryUsage beforeGcUsage = null; MemoryUsage afterGcUsage = null; long gcId = 0; if (lastGcInfo != null) { gcId = lastGcInfo.getId(); lastGcStartTime = lastGcInfo.getStartTime(); lastGcEndTime = lastGcInfo.getEndTime(); beforeGcUsage = lastGcInfo.getMemoryUsageBeforeGc().get(poolName); afterGcUsage = lastGcInfo.getMemoryUsageAfterGc().get(poolName); } Set<Map.Entry<ObjectName,Long>> set = gcMBeans.entrySet(); for (Map.Entry<ObjectName,Long> e : set) { GarbageCollectorMXBean gc = client.getMXBean(e.getKey(), com.sun.management.GarbageCollectorMXBean.class); Long gcCount = e.getValue(); Long newCount = gc.getCollectionCount(); if (newCount > gcCount) { gcMBeans.put(e.getKey(), new Long(newCount)); lastGcInfo = gc.getLastGcInfo(); if (lastGcInfo.getEndTime() > lastGcEndTime) { gcId = lastGcInfo.getId(); lastGcStartTime = lastGcInfo.getStartTime(); lastGcEndTime = lastGcInfo.getEndTime(); beforeGcUsage = lastGcInfo.getMemoryUsageBeforeGc().get(poolName); afterGcUsage = lastGcInfo.getMemoryUsageAfterGc().get(poolName); assert(beforeGcUsage != null); assert(afterGcUsage != null); } } } MemoryUsage usage = pool.getUsage(); return new MemoryPoolStat(poolName, usageThreshold, usage, gcId, lastGcStartTime, lastGcEndTime, collectThreshold, beforeGcUsage, afterGcUsage); }
Example 4
Source File: MemoryPoolProxy.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public MemoryPoolStat getStat() throws java.io.IOException { long usageThreshold = (pool.isUsageThresholdSupported() ? pool.getUsageThreshold() : -1); long collectThreshold = (pool.isCollectionUsageThresholdSupported() ? pool.getCollectionUsageThreshold() : -1); long lastGcStartTime = 0; long lastGcEndTime = 0; MemoryUsage beforeGcUsage = null; MemoryUsage afterGcUsage = null; long gcId = 0; if (lastGcInfo != null) { gcId = lastGcInfo.getId(); lastGcStartTime = lastGcInfo.getStartTime(); lastGcEndTime = lastGcInfo.getEndTime(); beforeGcUsage = lastGcInfo.getMemoryUsageBeforeGc().get(poolName); afterGcUsage = lastGcInfo.getMemoryUsageAfterGc().get(poolName); } Set<Map.Entry<ObjectName,Long>> set = gcMBeans.entrySet(); for (Map.Entry<ObjectName,Long> e : set) { GarbageCollectorMXBean gc = client.getMXBean(e.getKey(), com.sun.management.GarbageCollectorMXBean.class); Long gcCount = e.getValue(); Long newCount = gc.getCollectionCount(); if (newCount > gcCount) { gcMBeans.put(e.getKey(), new Long(newCount)); lastGcInfo = gc.getLastGcInfo(); if (lastGcInfo.getEndTime() > lastGcEndTime) { gcId = lastGcInfo.getId(); lastGcStartTime = lastGcInfo.getStartTime(); lastGcEndTime = lastGcInfo.getEndTime(); beforeGcUsage = lastGcInfo.getMemoryUsageBeforeGc().get(poolName); afterGcUsage = lastGcInfo.getMemoryUsageAfterGc().get(poolName); assert(beforeGcUsage != null); assert(afterGcUsage != null); } } } MemoryUsage usage = pool.getUsage(); return new MemoryPoolStat(poolName, usageThreshold, usage, gcId, lastGcStartTime, lastGcEndTime, collectThreshold, beforeGcUsage, afterGcUsage); }
Example 5
Source File: MemoryPoolProxy.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public MemoryPoolStat getStat() throws java.io.IOException { long usageThreshold = (pool.isUsageThresholdSupported() ? pool.getUsageThreshold() : -1); long collectThreshold = (pool.isCollectionUsageThresholdSupported() ? pool.getCollectionUsageThreshold() : -1); long lastGcStartTime = 0; long lastGcEndTime = 0; MemoryUsage beforeGcUsage = null; MemoryUsage afterGcUsage = null; long gcId = 0; if (lastGcInfo != null) { gcId = lastGcInfo.getId(); lastGcStartTime = lastGcInfo.getStartTime(); lastGcEndTime = lastGcInfo.getEndTime(); beforeGcUsage = lastGcInfo.getMemoryUsageBeforeGc().get(poolName); afterGcUsage = lastGcInfo.getMemoryUsageAfterGc().get(poolName); } Set<Map.Entry<ObjectName,Long>> set = gcMBeans.entrySet(); for (Map.Entry<ObjectName,Long> e : set) { GarbageCollectorMXBean gc = client.getMXBean(e.getKey(), com.sun.management.GarbageCollectorMXBean.class); Long gcCount = e.getValue(); Long newCount = gc.getCollectionCount(); if (newCount > gcCount) { gcMBeans.put(e.getKey(), new Long(newCount)); lastGcInfo = gc.getLastGcInfo(); if (lastGcInfo.getEndTime() > lastGcEndTime) { gcId = lastGcInfo.getId(); lastGcStartTime = lastGcInfo.getStartTime(); lastGcEndTime = lastGcInfo.getEndTime(); beforeGcUsage = lastGcInfo.getMemoryUsageBeforeGc().get(poolName); afterGcUsage = lastGcInfo.getMemoryUsageAfterGc().get(poolName); assert(beforeGcUsage != null); assert(afterGcUsage != null); } } } MemoryUsage usage = pool.getUsage(); return new MemoryPoolStat(poolName, usageThreshold, usage, gcId, lastGcStartTime, lastGcEndTime, collectThreshold, beforeGcUsage, afterGcUsage); }
Example 6
Source File: MemoryPoolProxy.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public MemoryPoolStat getStat() throws java.io.IOException { long usageThreshold = (pool.isUsageThresholdSupported() ? pool.getUsageThreshold() : -1); long collectThreshold = (pool.isCollectionUsageThresholdSupported() ? pool.getCollectionUsageThreshold() : -1); long lastGcStartTime = 0; long lastGcEndTime = 0; MemoryUsage beforeGcUsage = null; MemoryUsage afterGcUsage = null; long gcId = 0; if (lastGcInfo != null) { gcId = lastGcInfo.getId(); lastGcStartTime = lastGcInfo.getStartTime(); lastGcEndTime = lastGcInfo.getEndTime(); beforeGcUsage = lastGcInfo.getMemoryUsageBeforeGc().get(poolName); afterGcUsage = lastGcInfo.getMemoryUsageAfterGc().get(poolName); } Set<Map.Entry<ObjectName,Long>> set = gcMBeans.entrySet(); for (Map.Entry<ObjectName,Long> e : set) { GarbageCollectorMXBean gc = client.getMXBean(e.getKey(), com.sun.management.GarbageCollectorMXBean.class); Long gcCount = e.getValue(); Long newCount = gc.getCollectionCount(); if (newCount > gcCount) { gcMBeans.put(e.getKey(), new Long(newCount)); lastGcInfo = gc.getLastGcInfo(); if (lastGcInfo.getEndTime() > lastGcEndTime) { gcId = lastGcInfo.getId(); lastGcStartTime = lastGcInfo.getStartTime(); lastGcEndTime = lastGcInfo.getEndTime(); beforeGcUsage = lastGcInfo.getMemoryUsageBeforeGc().get(poolName); afterGcUsage = lastGcInfo.getMemoryUsageAfterGc().get(poolName); assert(beforeGcUsage != null); assert(afterGcUsage != null); } } } MemoryUsage usage = pool.getUsage(); return new MemoryPoolStat(poolName, usageThreshold, usage, gcId, lastGcStartTime, lastGcEndTime, collectThreshold, beforeGcUsage, afterGcUsage); }
Example 7
Source File: MemoryPoolProxy.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public MemoryPoolStat getStat() throws java.io.IOException { long usageThreshold = (pool.isUsageThresholdSupported() ? pool.getUsageThreshold() : -1); long collectThreshold = (pool.isCollectionUsageThresholdSupported() ? pool.getCollectionUsageThreshold() : -1); long lastGcStartTime = 0; long lastGcEndTime = 0; MemoryUsage beforeGcUsage = null; MemoryUsage afterGcUsage = null; long gcId = 0; if (lastGcInfo != null) { gcId = lastGcInfo.getId(); lastGcStartTime = lastGcInfo.getStartTime(); lastGcEndTime = lastGcInfo.getEndTime(); beforeGcUsage = lastGcInfo.getMemoryUsageBeforeGc().get(poolName); afterGcUsage = lastGcInfo.getMemoryUsageAfterGc().get(poolName); } Set<Map.Entry<ObjectName,Long>> set = gcMBeans.entrySet(); for (Map.Entry<ObjectName,Long> e : set) { GarbageCollectorMXBean gc = client.getMXBean(e.getKey(), com.sun.management.GarbageCollectorMXBean.class); Long gcCount = e.getValue(); Long newCount = gc.getCollectionCount(); if (newCount > gcCount) { gcMBeans.put(e.getKey(), newCount); lastGcInfo = gc.getLastGcInfo(); if (lastGcInfo.getEndTime() > lastGcEndTime) { gcId = lastGcInfo.getId(); lastGcStartTime = lastGcInfo.getStartTime(); lastGcEndTime = lastGcInfo.getEndTime(); beforeGcUsage = lastGcInfo.getMemoryUsageBeforeGc().get(poolName); afterGcUsage = lastGcInfo.getMemoryUsageAfterGc().get(poolName); assert(beforeGcUsage != null); assert(afterGcUsage != null); } } } MemoryUsage usage = pool.getUsage(); return new MemoryPoolStat(poolName, usageThreshold, usage, gcId, lastGcStartTime, lastGcEndTime, collectThreshold, beforeGcUsage, afterGcUsage); }
Example 8
Source File: MemoryPoolProxy.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public MemoryPoolStat getStat() throws java.io.IOException { long usageThreshold = (pool.isUsageThresholdSupported() ? pool.getUsageThreshold() : -1); long collectThreshold = (pool.isCollectionUsageThresholdSupported() ? pool.getCollectionUsageThreshold() : -1); long lastGcStartTime = 0; long lastGcEndTime = 0; MemoryUsage beforeGcUsage = null; MemoryUsage afterGcUsage = null; long gcId = 0; if (lastGcInfo != null) { gcId = lastGcInfo.getId(); lastGcStartTime = lastGcInfo.getStartTime(); lastGcEndTime = lastGcInfo.getEndTime(); beforeGcUsage = lastGcInfo.getMemoryUsageBeforeGc().get(poolName); afterGcUsage = lastGcInfo.getMemoryUsageAfterGc().get(poolName); } Set<Map.Entry<ObjectName,Long>> set = gcMBeans.entrySet(); for (Map.Entry<ObjectName,Long> e : set) { GarbageCollectorMXBean gc = client.getMXBean(e.getKey(), com.sun.management.GarbageCollectorMXBean.class); Long gcCount = e.getValue(); Long newCount = gc.getCollectionCount(); if (newCount > gcCount) { gcMBeans.put(e.getKey(), new Long(newCount)); lastGcInfo = gc.getLastGcInfo(); if (lastGcInfo.getEndTime() > lastGcEndTime) { gcId = lastGcInfo.getId(); lastGcStartTime = lastGcInfo.getStartTime(); lastGcEndTime = lastGcInfo.getEndTime(); beforeGcUsage = lastGcInfo.getMemoryUsageBeforeGc().get(poolName); afterGcUsage = lastGcInfo.getMemoryUsageAfterGc().get(poolName); assert(beforeGcUsage != null); assert(afterGcUsage != null); } } } MemoryUsage usage = pool.getUsage(); return new MemoryPoolStat(poolName, usageThreshold, usage, gcId, lastGcStartTime, lastGcEndTime, collectThreshold, beforeGcUsage, afterGcUsage); }
Example 9
Source File: MemoryPoolProxy.java From hottub with GNU General Public License v2.0 | 4 votes |
public MemoryPoolStat getStat() throws java.io.IOException { long usageThreshold = (pool.isUsageThresholdSupported() ? pool.getUsageThreshold() : -1); long collectThreshold = (pool.isCollectionUsageThresholdSupported() ? pool.getCollectionUsageThreshold() : -1); long lastGcStartTime = 0; long lastGcEndTime = 0; MemoryUsage beforeGcUsage = null; MemoryUsage afterGcUsage = null; long gcId = 0; if (lastGcInfo != null) { gcId = lastGcInfo.getId(); lastGcStartTime = lastGcInfo.getStartTime(); lastGcEndTime = lastGcInfo.getEndTime(); beforeGcUsage = lastGcInfo.getMemoryUsageBeforeGc().get(poolName); afterGcUsage = lastGcInfo.getMemoryUsageAfterGc().get(poolName); } Set<Map.Entry<ObjectName,Long>> set = gcMBeans.entrySet(); for (Map.Entry<ObjectName,Long> e : set) { GarbageCollectorMXBean gc = client.getMXBean(e.getKey(), com.sun.management.GarbageCollectorMXBean.class); Long gcCount = e.getValue(); Long newCount = gc.getCollectionCount(); if (newCount > gcCount) { gcMBeans.put(e.getKey(), new Long(newCount)); lastGcInfo = gc.getLastGcInfo(); if (lastGcInfo.getEndTime() > lastGcEndTime) { gcId = lastGcInfo.getId(); lastGcStartTime = lastGcInfo.getStartTime(); lastGcEndTime = lastGcInfo.getEndTime(); beforeGcUsage = lastGcInfo.getMemoryUsageBeforeGc().get(poolName); afterGcUsage = lastGcInfo.getMemoryUsageAfterGc().get(poolName); assert(beforeGcUsage != null); assert(afterGcUsage != null); } } } MemoryUsage usage = pool.getUsage(); return new MemoryPoolStat(poolName, usageThreshold, usage, gcId, lastGcStartTime, lastGcEndTime, collectThreshold, beforeGcUsage, afterGcUsage); }
Example 10
Source File: MemoryPoolProxy.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public MemoryPoolStat getStat() throws java.io.IOException { long usageThreshold = (pool.isUsageThresholdSupported() ? pool.getUsageThreshold() : -1); long collectThreshold = (pool.isCollectionUsageThresholdSupported() ? pool.getCollectionUsageThreshold() : -1); long lastGcStartTime = 0; long lastGcEndTime = 0; MemoryUsage beforeGcUsage = null; MemoryUsage afterGcUsage = null; long gcId = 0; if (lastGcInfo != null) { gcId = lastGcInfo.getId(); lastGcStartTime = lastGcInfo.getStartTime(); lastGcEndTime = lastGcInfo.getEndTime(); beforeGcUsage = lastGcInfo.getMemoryUsageBeforeGc().get(poolName); afterGcUsage = lastGcInfo.getMemoryUsageAfterGc().get(poolName); } Set<Map.Entry<ObjectName,Long>> set = gcMBeans.entrySet(); for (Map.Entry<ObjectName,Long> e : set) { GarbageCollectorMXBean gc = client.getMXBean(e.getKey(), com.sun.management.GarbageCollectorMXBean.class); Long gcCount = e.getValue(); Long newCount = gc.getCollectionCount(); if (newCount > gcCount) { gcMBeans.put(e.getKey(), new Long(newCount)); lastGcInfo = gc.getLastGcInfo(); if (lastGcInfo.getEndTime() > lastGcEndTime) { gcId = lastGcInfo.getId(); lastGcStartTime = lastGcInfo.getStartTime(); lastGcEndTime = lastGcInfo.getEndTime(); beforeGcUsage = lastGcInfo.getMemoryUsageBeforeGc().get(poolName); afterGcUsage = lastGcInfo.getMemoryUsageAfterGc().get(poolName); assert(beforeGcUsage != null); assert(afterGcUsage != null); } } } MemoryUsage usage = pool.getUsage(); return new MemoryPoolStat(poolName, usageThreshold, usage, gcId, lastGcStartTime, lastGcEndTime, collectThreshold, beforeGcUsage, afterGcUsage); }
Example 11
Source File: MemoryPoolProxy.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public MemoryPoolStat getStat() throws java.io.IOException { long usageThreshold = (pool.isUsageThresholdSupported() ? pool.getUsageThreshold() : -1); long collectThreshold = (pool.isCollectionUsageThresholdSupported() ? pool.getCollectionUsageThreshold() : -1); long lastGcStartTime = 0; long lastGcEndTime = 0; MemoryUsage beforeGcUsage = null; MemoryUsage afterGcUsage = null; long gcId = 0; if (lastGcInfo != null) { gcId = lastGcInfo.getId(); lastGcStartTime = lastGcInfo.getStartTime(); lastGcEndTime = lastGcInfo.getEndTime(); beforeGcUsage = lastGcInfo.getMemoryUsageBeforeGc().get(poolName); afterGcUsage = lastGcInfo.getMemoryUsageAfterGc().get(poolName); } Set<Map.Entry<ObjectName,Long>> set = gcMBeans.entrySet(); for (Map.Entry<ObjectName,Long> e : set) { GarbageCollectorMXBean gc = client.getMXBean(e.getKey(), com.sun.management.GarbageCollectorMXBean.class); Long gcCount = e.getValue(); Long newCount = gc.getCollectionCount(); if (newCount > gcCount) { gcMBeans.put(e.getKey(), new Long(newCount)); lastGcInfo = gc.getLastGcInfo(); if (lastGcInfo.getEndTime() > lastGcEndTime) { gcId = lastGcInfo.getId(); lastGcStartTime = lastGcInfo.getStartTime(); lastGcEndTime = lastGcInfo.getEndTime(); beforeGcUsage = lastGcInfo.getMemoryUsageBeforeGc().get(poolName); afterGcUsage = lastGcInfo.getMemoryUsageAfterGc().get(poolName); assert(beforeGcUsage != null); assert(afterGcUsage != null); } } } MemoryUsage usage = pool.getUsage(); return new MemoryPoolStat(poolName, usageThreshold, usage, gcId, lastGcStartTime, lastGcEndTime, collectThreshold, beforeGcUsage, afterGcUsage); }
Example 12
Source File: MemoryPoolProxy.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
public MemoryPoolStat getStat() throws java.io.IOException { long usageThreshold = (pool.isUsageThresholdSupported() ? pool.getUsageThreshold() : -1); long collectThreshold = (pool.isCollectionUsageThresholdSupported() ? pool.getCollectionUsageThreshold() : -1); long lastGcStartTime = 0; long lastGcEndTime = 0; MemoryUsage beforeGcUsage = null; MemoryUsage afterGcUsage = null; long gcId = 0; if (lastGcInfo != null) { gcId = lastGcInfo.getId(); lastGcStartTime = lastGcInfo.getStartTime(); lastGcEndTime = lastGcInfo.getEndTime(); beforeGcUsage = lastGcInfo.getMemoryUsageBeforeGc().get(poolName); afterGcUsage = lastGcInfo.getMemoryUsageAfterGc().get(poolName); } Set<Map.Entry<ObjectName,Long>> set = gcMBeans.entrySet(); for (Map.Entry<ObjectName,Long> e : set) { GarbageCollectorMXBean gc = client.getMXBean(e.getKey(), com.sun.management.GarbageCollectorMXBean.class); Long gcCount = e.getValue(); Long newCount = gc.getCollectionCount(); if (newCount > gcCount) { gcMBeans.put(e.getKey(), new Long(newCount)); lastGcInfo = gc.getLastGcInfo(); if (lastGcInfo.getEndTime() > lastGcEndTime) { gcId = lastGcInfo.getId(); lastGcStartTime = lastGcInfo.getStartTime(); lastGcEndTime = lastGcInfo.getEndTime(); beforeGcUsage = lastGcInfo.getMemoryUsageBeforeGc().get(poolName); afterGcUsage = lastGcInfo.getMemoryUsageAfterGc().get(poolName); assert(beforeGcUsage != null); assert(afterGcUsage != null); } } } MemoryUsage usage = pool.getUsage(); return new MemoryPoolStat(poolName, usageThreshold, usage, gcId, lastGcStartTime, lastGcEndTime, collectThreshold, beforeGcUsage, afterGcUsage); }
Example 13
Source File: MemoryPoolProxy.java From jmxmon with Apache License 2.0 | 4 votes |
public MemoryPoolStat getStat() throws java.io.IOException { long usageThreshold = (pool.isUsageThresholdSupported() ? pool.getUsageThreshold() : -1); long collectThreshold = (pool.isCollectionUsageThresholdSupported() ? pool.getCollectionUsageThreshold() : -1); long lastGcStartTime = 0; long lastGcEndTime = 0; MemoryUsage beforeGcUsage = null; MemoryUsage afterGcUsage = null; long gcId = 0; if (lastGcInfo != null) { gcId = lastGcInfo.getId(); lastGcStartTime = lastGcInfo.getStartTime(); lastGcEndTime = lastGcInfo.getEndTime(); beforeGcUsage = lastGcInfo.getMemoryUsageBeforeGc().get(poolName); afterGcUsage = lastGcInfo.getMemoryUsageAfterGc().get(poolName); } Set<Map.Entry<ObjectName,Long>> set = gcMBeans.entrySet(); for (Map.Entry<ObjectName,Long> e : set) { GarbageCollectorMXBean gc = client.getMXBean(e.getKey(), com.sun.management.GarbageCollectorMXBean.class); Long gcCount = e.getValue(); Long newCount = gc.getCollectionCount(); if (newCount > gcCount) { gcMBeans.put(e.getKey(), new Long(newCount)); lastGcInfo = gc.getLastGcInfo(); if (lastGcInfo.getEndTime() > lastGcEndTime) { gcId = lastGcInfo.getId(); lastGcStartTime = lastGcInfo.getStartTime(); lastGcEndTime = lastGcInfo.getEndTime(); beforeGcUsage = lastGcInfo.getMemoryUsageBeforeGc().get(poolName); afterGcUsage = lastGcInfo.getMemoryUsageAfterGc().get(poolName); assert(beforeGcUsage != null); assert(afterGcUsage != null); } } } MemoryUsage usage = pool.getUsage(); return new MemoryPoolStat(poolName, usageThreshold, usage, gcId, lastGcStartTime, lastGcEndTime, collectThreshold, beforeGcUsage, afterGcUsage); }
Example 14
Source File: MemoryPoolProxy.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public MemoryPoolStat getStat() throws java.io.IOException { long usageThreshold = (pool.isUsageThresholdSupported() ? pool.getUsageThreshold() : -1); long collectThreshold = (pool.isCollectionUsageThresholdSupported() ? pool.getCollectionUsageThreshold() : -1); long lastGcStartTime = 0; long lastGcEndTime = 0; MemoryUsage beforeGcUsage = null; MemoryUsage afterGcUsage = null; long gcId = 0; if (lastGcInfo != null) { gcId = lastGcInfo.getId(); lastGcStartTime = lastGcInfo.getStartTime(); lastGcEndTime = lastGcInfo.getEndTime(); beforeGcUsage = lastGcInfo.getMemoryUsageBeforeGc().get(poolName); afterGcUsage = lastGcInfo.getMemoryUsageAfterGc().get(poolName); } Set<Map.Entry<ObjectName,Long>> set = gcMBeans.entrySet(); for (Map.Entry<ObjectName,Long> e : set) { GarbageCollectorMXBean gc = client.getMXBean(e.getKey(), com.sun.management.GarbageCollectorMXBean.class); Long gcCount = e.getValue(); Long newCount = gc.getCollectionCount(); if (newCount > gcCount) { gcMBeans.put(e.getKey(), new Long(newCount)); lastGcInfo = gc.getLastGcInfo(); if (lastGcInfo.getEndTime() > lastGcEndTime) { gcId = lastGcInfo.getId(); lastGcStartTime = lastGcInfo.getStartTime(); lastGcEndTime = lastGcInfo.getEndTime(); beforeGcUsage = lastGcInfo.getMemoryUsageBeforeGc().get(poolName); afterGcUsage = lastGcInfo.getMemoryUsageAfterGc().get(poolName); assert(beforeGcUsage != null); assert(afterGcUsage != null); } } } MemoryUsage usage = pool.getUsage(); return new MemoryPoolStat(poolName, usageThreshold, usage, gcId, lastGcStartTime, lastGcEndTime, collectThreshold, beforeGcUsage, afterGcUsage); }
Example 15
Source File: MemoryPoolProxy.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
public MemoryPoolStat getStat() throws java.io.IOException { long usageThreshold = (pool.isUsageThresholdSupported() ? pool.getUsageThreshold() : -1); long collectThreshold = (pool.isCollectionUsageThresholdSupported() ? pool.getCollectionUsageThreshold() : -1); long lastGcStartTime = 0; long lastGcEndTime = 0; MemoryUsage beforeGcUsage = null; MemoryUsage afterGcUsage = null; long gcId = 0; if (lastGcInfo != null) { gcId = lastGcInfo.getId(); lastGcStartTime = lastGcInfo.getStartTime(); lastGcEndTime = lastGcInfo.getEndTime(); beforeGcUsage = lastGcInfo.getMemoryUsageBeforeGc().get(poolName); afterGcUsage = lastGcInfo.getMemoryUsageAfterGc().get(poolName); } Set<Map.Entry<ObjectName,Long>> set = gcMBeans.entrySet(); for (Map.Entry<ObjectName,Long> e : set) { GarbageCollectorMXBean gc = client.getMXBean(e.getKey(), com.sun.management.GarbageCollectorMXBean.class); Long gcCount = e.getValue(); Long newCount = gc.getCollectionCount(); if (newCount > gcCount) { gcMBeans.put(e.getKey(), new Long(newCount)); lastGcInfo = gc.getLastGcInfo(); if (lastGcInfo.getEndTime() > lastGcEndTime) { gcId = lastGcInfo.getId(); lastGcStartTime = lastGcInfo.getStartTime(); lastGcEndTime = lastGcInfo.getEndTime(); beforeGcUsage = lastGcInfo.getMemoryUsageBeforeGc().get(poolName); afterGcUsage = lastGcInfo.getMemoryUsageAfterGc().get(poolName); assert(beforeGcUsage != null); assert(afterGcUsage != null); } } } MemoryUsage usage = pool.getUsage(); return new MemoryPoolStat(poolName, usageThreshold, usage, gcId, lastGcStartTime, lastGcEndTime, collectThreshold, beforeGcUsage, afterGcUsage); }