Java Code Examples for java.lang.management.MemoryPoolMXBean#resetPeakUsage()
The following examples show how to use
java.lang.management.MemoryPoolMXBean#resetPeakUsage() .
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: Diagnostics.java From Tomcat8-Source-Read with MIT License | 5 votes |
/** * Reset peak memory usage data in MemoryPoolMXBean * * @param name name of the MemoryPoolMXBean or "all" */ public static void resetPeakUsage(String name) { for (MemoryPoolMXBean mbean: memoryPoolMXBeans) { if (name.equals("all") || name.equals(mbean.getName())) { mbean.resetPeakUsage(); } } }
Example 2
Source File: MXBeanInteropTest1.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
private final int doMemoryPoolMXBeanTest(MBeanServerConnection mbsc) { int errorCount = 0 ; System.out.println("---- MemoryPoolMXBean") ; try { ObjectName filterName = new ObjectName(ManagementFactory.MEMORY_POOL_MXBEAN_DOMAIN_TYPE + ",*"); Set<ObjectName> onSet = mbsc.queryNames(filterName, null); for (Iterator<ObjectName> iter = onSet.iterator(); iter.hasNext(); ) { ObjectName memoryPoolName = iter.next() ; System.out.println("-------- " + memoryPoolName) ; MBeanInfo mbInfo = mbsc.getMBeanInfo(memoryPoolName); errorCount += checkNonEmpty(mbInfo); System.out.println("getMBeanInfo\t\t" + mbInfo); MemoryPoolMXBean memoryPool = null; memoryPool = JMX.newMXBeanProxy(mbsc, memoryPoolName, MemoryPoolMXBean.class, true) ; System.out.println("getCollectionUsage\t\t" + memoryPool.getCollectionUsage()); System.out.println("getMemoryManagerNames\t\t" + Arrays.deepToString(memoryPool.getMemoryManagerNames())); System.out.println("getName\t\t" + memoryPool.getName()); System.out.println("getPeakUsage\t\t" + memoryPool.getPeakUsage()); System.out.println("getType\t\t" + memoryPool.getType()); System.out.println("getUsage\t\t" + memoryPool.getUsage()); System.out.println("isValid\t\t" + memoryPool.isValid()); boolean supported = memoryPool.isUsageThresholdSupported() ; System.out.println("isUsageThresholdSupported\t\t" + supported); if ( supported ) { System.out.println("getUsageThreshold\t\t" + memoryPool.getUsageThreshold()); System.out.println("isUsageThresholdExceeded\t\t" + memoryPool.isUsageThresholdExceeded()); System.out.println("getUsageThresholdCount\t\t" + memoryPool.getUsageThresholdCount()); } supported = memoryPool.isCollectionUsageThresholdSupported() ; System.out.println("isCollectionUsageThresholdSupported\t\t" + supported); if ( supported ) { System.out.println("getCollectionUsageThreshold\t\t" + memoryPool.getCollectionUsageThreshold()); System.out.println("getCollectionUsageThresholdCount\t\t" + memoryPool.getCollectionUsageThresholdCount()); System.out.println("isCollectionUsageThresholdExceeded\t\t" + memoryPool.isCollectionUsageThresholdExceeded()); } memoryPool.resetPeakUsage(); } System.out.println("---- OK\n") ; } catch (Exception e) { Utils.printThrowable(e, true) ; errorCount++ ; System.out.println("---- ERROR\n") ; } return errorCount ; }
Example 3
Source File: MXBeanInteropTest1.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private final int doMemoryPoolMXBeanTest(MBeanServerConnection mbsc) { int errorCount = 0 ; System.out.println("---- MemoryPoolMXBean") ; try { ObjectName filterName = new ObjectName(ManagementFactory.MEMORY_POOL_MXBEAN_DOMAIN_TYPE + ",*"); Set<ObjectName> onSet = mbsc.queryNames(filterName, null); for (Iterator<ObjectName> iter = onSet.iterator(); iter.hasNext(); ) { ObjectName memoryPoolName = iter.next() ; System.out.println("-------- " + memoryPoolName) ; MBeanInfo mbInfo = mbsc.getMBeanInfo(memoryPoolName); errorCount += checkNonEmpty(mbInfo); System.out.println("getMBeanInfo\t\t" + mbInfo); MemoryPoolMXBean memoryPool = null; memoryPool = JMX.newMXBeanProxy(mbsc, memoryPoolName, MemoryPoolMXBean.class, true) ; System.out.println("getCollectionUsage\t\t" + memoryPool.getCollectionUsage()); System.out.println("getMemoryManagerNames\t\t" + Arrays.deepToString(memoryPool.getMemoryManagerNames())); System.out.println("getName\t\t" + memoryPool.getName()); System.out.println("getPeakUsage\t\t" + memoryPool.getPeakUsage()); System.out.println("getType\t\t" + memoryPool.getType()); System.out.println("getUsage\t\t" + memoryPool.getUsage()); System.out.println("isValid\t\t" + memoryPool.isValid()); boolean supported = memoryPool.isUsageThresholdSupported() ; System.out.println("isUsageThresholdSupported\t\t" + supported); if ( supported ) { System.out.println("getUsageThreshold\t\t" + memoryPool.getUsageThreshold()); System.out.println("isUsageThresholdExceeded\t\t" + memoryPool.isUsageThresholdExceeded()); System.out.println("getUsageThresholdCount\t\t" + memoryPool.getUsageThresholdCount()); } supported = memoryPool.isCollectionUsageThresholdSupported() ; System.out.println("isCollectionUsageThresholdSupported\t\t" + supported); if ( supported ) { System.out.println("getCollectionUsageThreshold\t\t" + memoryPool.getCollectionUsageThreshold()); System.out.println("getCollectionUsageThresholdCount\t\t" + memoryPool.getCollectionUsageThresholdCount()); System.out.println("isCollectionUsageThresholdExceeded\t\t" + memoryPool.isCollectionUsageThresholdExceeded()); } memoryPool.resetPeakUsage(); } System.out.println("---- OK\n") ; } catch (Exception e) { Utils.printThrowable(e, true) ; errorCount++ ; System.out.println("---- ERROR\n") ; } return errorCount ; }
Example 4
Source File: MXBeanInteropTest1.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private final int doMemoryPoolMXBeanTest(MBeanServerConnection mbsc) { int errorCount = 0 ; System.out.println("---- MemoryPoolMXBean") ; try { ObjectName filterName = new ObjectName(ManagementFactory.MEMORY_POOL_MXBEAN_DOMAIN_TYPE + ",*"); Set<ObjectName> onSet = mbsc.queryNames(filterName, null); for (Iterator<ObjectName> iter = onSet.iterator(); iter.hasNext(); ) { ObjectName memoryPoolName = iter.next() ; System.out.println("-------- " + memoryPoolName) ; MBeanInfo mbInfo = mbsc.getMBeanInfo(memoryPoolName); errorCount += checkNonEmpty(mbInfo); System.out.println("getMBeanInfo\t\t" + mbInfo); MemoryPoolMXBean memoryPool = null; memoryPool = JMX.newMXBeanProxy(mbsc, memoryPoolName, MemoryPoolMXBean.class, true) ; System.out.println("getCollectionUsage\t\t" + memoryPool.getCollectionUsage()); System.out.println("getMemoryManagerNames\t\t" + Arrays.deepToString(memoryPool.getMemoryManagerNames())); System.out.println("getName\t\t" + memoryPool.getName()); System.out.println("getPeakUsage\t\t" + memoryPool.getPeakUsage()); System.out.println("getType\t\t" + memoryPool.getType()); System.out.println("getUsage\t\t" + memoryPool.getUsage()); System.out.println("isValid\t\t" + memoryPool.isValid()); boolean supported = memoryPool.isUsageThresholdSupported() ; System.out.println("isUsageThresholdSupported\t\t" + supported); if ( supported ) { System.out.println("getUsageThreshold\t\t" + memoryPool.getUsageThreshold()); System.out.println("isUsageThresholdExceeded\t\t" + memoryPool.isUsageThresholdExceeded()); System.out.println("getUsageThresholdCount\t\t" + memoryPool.getUsageThresholdCount()); } supported = memoryPool.isCollectionUsageThresholdSupported() ; System.out.println("isCollectionUsageThresholdSupported\t\t" + supported); if ( supported ) { System.out.println("getCollectionUsageThreshold\t\t" + memoryPool.getCollectionUsageThreshold()); System.out.println("getCollectionUsageThresholdCount\t\t" + memoryPool.getCollectionUsageThresholdCount()); System.out.println("isCollectionUsageThresholdExceeded\t\t" + memoryPool.isCollectionUsageThresholdExceeded()); } memoryPool.resetPeakUsage(); } System.out.println("---- OK\n") ; } catch (Exception e) { Utils.printThrowable(e, true) ; errorCount++ ; System.out.println("---- ERROR\n") ; } return errorCount ; }
Example 5
Source File: VMLogger.java From openjdk-systemtest with Apache License 2.0 | 4 votes |
public void enableOptionalFunctionality() { try { // ClassLoadingMXBean operations classBean.setVerbose(true); // MemoryMXBean operations memBean.setVerbose(true); // MemoryPoolMXBean operations for (MemoryPoolMXBean memPoolBean: memPoolBeans) { memPoolBean.resetPeakUsage(); if (memPoolBean.isCollectionUsageThresholdSupported()) { memPoolBean.setCollectionUsageThreshold(10000); } if (memPoolBean.isUsageThresholdSupported()) { memPoolBean.setUsageThreshold(200000); } } // ThreadMXBean operations threadBean.resetPeakThreadCount(); if (threadBean.isThreadContentionMonitoringSupported()) { threadBean.setThreadContentionMonitoringEnabled(true); } if (threadBean.isThreadCpuTimeSupported()) { threadBean.setThreadCpuTimeEnabled(true); } // LoggingMXBean operations List<String> loggers = logBean.getLoggerNames(); String[] levels = {"SEVERE", "WARNING", "INFO", "CONFIG", "FINE", "FINER", "FINEST"}; int i = 0; for( String logger : loggers) { if (i > 6) { i = i - 7; } // There's a chance the logger no longer exists String parent = logBean.getParentLoggerName(logger); if (parent != null) { logBean.setLoggerLevel(logger, levels[i]); } i++; } } catch (UnsupportedOperationException uoe) { Message.logOut("One of the operations you tried is not supported"); uoe.printStackTrace(); } }
Example 6
Source File: MXBeanInteropTest1.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
private final int doMemoryPoolMXBeanTest(MBeanServerConnection mbsc) { int errorCount = 0 ; System.out.println("---- MemoryPoolMXBean") ; try { ObjectName filterName = new ObjectName(ManagementFactory.MEMORY_POOL_MXBEAN_DOMAIN_TYPE + ",*"); Set<ObjectName> onSet = mbsc.queryNames(filterName, null); for (Iterator<ObjectName> iter = onSet.iterator(); iter.hasNext(); ) { ObjectName memoryPoolName = iter.next() ; System.out.println("-------- " + memoryPoolName) ; MBeanInfo mbInfo = mbsc.getMBeanInfo(memoryPoolName); errorCount += checkNonEmpty(mbInfo); System.out.println("getMBeanInfo\t\t" + mbInfo); MemoryPoolMXBean memoryPool = null; memoryPool = JMX.newMXBeanProxy(mbsc, memoryPoolName, MemoryPoolMXBean.class, true) ; System.out.println("getCollectionUsage\t\t" + memoryPool.getCollectionUsage()); System.out.println("getMemoryManagerNames\t\t" + Arrays.deepToString(memoryPool.getMemoryManagerNames())); System.out.println("getName\t\t" + memoryPool.getName()); System.out.println("getPeakUsage\t\t" + memoryPool.getPeakUsage()); System.out.println("getType\t\t" + memoryPool.getType()); System.out.println("getUsage\t\t" + memoryPool.getUsage()); System.out.println("isValid\t\t" + memoryPool.isValid()); boolean supported = memoryPool.isUsageThresholdSupported() ; System.out.println("isUsageThresholdSupported\t\t" + supported); if ( supported ) { System.out.println("getUsageThreshold\t\t" + memoryPool.getUsageThreshold()); System.out.println("isUsageThresholdExceeded\t\t" + memoryPool.isUsageThresholdExceeded()); System.out.println("getUsageThresholdCount\t\t" + memoryPool.getUsageThresholdCount()); } supported = memoryPool.isCollectionUsageThresholdSupported() ; System.out.println("isCollectionUsageThresholdSupported\t\t" + supported); if ( supported ) { System.out.println("getCollectionUsageThreshold\t\t" + memoryPool.getCollectionUsageThreshold()); System.out.println("getCollectionUsageThresholdCount\t\t" + memoryPool.getCollectionUsageThresholdCount()); System.out.println("isCollectionUsageThresholdExceeded\t\t" + memoryPool.isCollectionUsageThresholdExceeded()); } memoryPool.resetPeakUsage(); } System.out.println("---- OK\n") ; } catch (Exception e) { Utils.printThrowable(e, true) ; errorCount++ ; System.out.println("---- ERROR\n") ; } return errorCount ; }
Example 7
Source File: MXBeanInteropTest1.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private final int doMemoryPoolMXBeanTest(MBeanServerConnection mbsc) { int errorCount = 0 ; System.out.println("---- MemoryPoolMXBean") ; try { ObjectName filterName = new ObjectName(ManagementFactory.MEMORY_POOL_MXBEAN_DOMAIN_TYPE + ",*"); Set<ObjectName> onSet = mbsc.queryNames(filterName, null); for (Iterator<ObjectName> iter = onSet.iterator(); iter.hasNext(); ) { ObjectName memoryPoolName = iter.next() ; System.out.println("-------- " + memoryPoolName) ; MBeanInfo mbInfo = mbsc.getMBeanInfo(memoryPoolName); errorCount += checkNonEmpty(mbInfo); System.out.println("getMBeanInfo\t\t" + mbInfo); MemoryPoolMXBean memoryPool = null; memoryPool = JMX.newMXBeanProxy(mbsc, memoryPoolName, MemoryPoolMXBean.class, true) ; System.out.println("getCollectionUsage\t\t" + memoryPool.getCollectionUsage()); System.out.println("getMemoryManagerNames\t\t" + Arrays.deepToString(memoryPool.getMemoryManagerNames())); System.out.println("getName\t\t" + memoryPool.getName()); System.out.println("getPeakUsage\t\t" + memoryPool.getPeakUsage()); System.out.println("getType\t\t" + memoryPool.getType()); System.out.println("getUsage\t\t" + memoryPool.getUsage()); System.out.println("isValid\t\t" + memoryPool.isValid()); boolean supported = memoryPool.isUsageThresholdSupported() ; System.out.println("isUsageThresholdSupported\t\t" + supported); if ( supported ) { System.out.println("getUsageThreshold\t\t" + memoryPool.getUsageThreshold()); System.out.println("isUsageThresholdExceeded\t\t" + memoryPool.isUsageThresholdExceeded()); System.out.println("getUsageThresholdCount\t\t" + memoryPool.getUsageThresholdCount()); } supported = memoryPool.isCollectionUsageThresholdSupported() ; System.out.println("isCollectionUsageThresholdSupported\t\t" + supported); if ( supported ) { System.out.println("getCollectionUsageThreshold\t\t" + memoryPool.getCollectionUsageThreshold()); System.out.println("getCollectionUsageThresholdCount\t\t" + memoryPool.getCollectionUsageThresholdCount()); System.out.println("isCollectionUsageThresholdExceeded\t\t" + memoryPool.isCollectionUsageThresholdExceeded()); } memoryPool.resetPeakUsage(); } System.out.println("---- OK\n") ; } catch (Exception e) { Utils.printThrowable(e, true) ; errorCount++ ; System.out.println("---- ERROR\n") ; } return errorCount ; }
Example 8
Source File: MXBeanInteropTest1.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
private final int doMemoryPoolMXBeanTest(MBeanServerConnection mbsc) { int errorCount = 0 ; System.out.println("---- MemoryPoolMXBean") ; try { ObjectName filterName = new ObjectName(ManagementFactory.MEMORY_POOL_MXBEAN_DOMAIN_TYPE + ",*"); Set<ObjectName> onSet = mbsc.queryNames(filterName, null); for (Iterator<ObjectName> iter = onSet.iterator(); iter.hasNext(); ) { ObjectName memoryPoolName = iter.next() ; System.out.println("-------- " + memoryPoolName) ; MBeanInfo mbInfo = mbsc.getMBeanInfo(memoryPoolName); errorCount += checkNonEmpty(mbInfo); System.out.println("getMBeanInfo\t\t" + mbInfo); MemoryPoolMXBean memoryPool = null; memoryPool = JMX.newMXBeanProxy(mbsc, memoryPoolName, MemoryPoolMXBean.class, true) ; System.out.println("getCollectionUsage\t\t" + memoryPool.getCollectionUsage()); System.out.println("getMemoryManagerNames\t\t" + Arrays.deepToString(memoryPool.getMemoryManagerNames())); System.out.println("getName\t\t" + memoryPool.getName()); System.out.println("getPeakUsage\t\t" + memoryPool.getPeakUsage()); System.out.println("getType\t\t" + memoryPool.getType()); System.out.println("getUsage\t\t" + memoryPool.getUsage()); System.out.println("isValid\t\t" + memoryPool.isValid()); boolean supported = memoryPool.isUsageThresholdSupported() ; System.out.println("isUsageThresholdSupported\t\t" + supported); if ( supported ) { System.out.println("getUsageThreshold\t\t" + memoryPool.getUsageThreshold()); System.out.println("isUsageThresholdExceeded\t\t" + memoryPool.isUsageThresholdExceeded()); System.out.println("getUsageThresholdCount\t\t" + memoryPool.getUsageThresholdCount()); } supported = memoryPool.isCollectionUsageThresholdSupported() ; System.out.println("isCollectionUsageThresholdSupported\t\t" + supported); if ( supported ) { System.out.println("getCollectionUsageThreshold\t\t" + memoryPool.getCollectionUsageThreshold()); System.out.println("getCollectionUsageThresholdCount\t\t" + memoryPool.getCollectionUsageThresholdCount()); System.out.println("isCollectionUsageThresholdExceeded\t\t" + memoryPool.isCollectionUsageThresholdExceeded()); } memoryPool.resetPeakUsage(); } System.out.println("---- OK\n") ; } catch (Exception e) { Utils.printThrowable(e, true) ; errorCount++ ; System.out.println("---- ERROR\n") ; } return errorCount ; }
Example 9
Source File: MXBeanInteropTest1.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
private final int doMemoryPoolMXBeanTest(MBeanServerConnection mbsc) { int errorCount = 0 ; System.out.println("---- MemoryPoolMXBean") ; try { ObjectName filterName = new ObjectName(ManagementFactory.MEMORY_POOL_MXBEAN_DOMAIN_TYPE + ",*"); Set<ObjectName> onSet = mbsc.queryNames(filterName, null); for (Iterator<ObjectName> iter = onSet.iterator(); iter.hasNext(); ) { ObjectName memoryPoolName = iter.next() ; System.out.println("-------- " + memoryPoolName) ; MBeanInfo mbInfo = mbsc.getMBeanInfo(memoryPoolName); errorCount += checkNonEmpty(mbInfo); System.out.println("getMBeanInfo\t\t" + mbInfo); MemoryPoolMXBean memoryPool = null; memoryPool = JMX.newMXBeanProxy(mbsc, memoryPoolName, MemoryPoolMXBean.class, true) ; System.out.println("getCollectionUsage\t\t" + memoryPool.getCollectionUsage()); System.out.println("getMemoryManagerNames\t\t" + Arrays.deepToString(memoryPool.getMemoryManagerNames())); System.out.println("getName\t\t" + memoryPool.getName()); System.out.println("getPeakUsage\t\t" + memoryPool.getPeakUsage()); System.out.println("getType\t\t" + memoryPool.getType()); System.out.println("getUsage\t\t" + memoryPool.getUsage()); System.out.println("isValid\t\t" + memoryPool.isValid()); boolean supported = memoryPool.isUsageThresholdSupported() ; System.out.println("isUsageThresholdSupported\t\t" + supported); if ( supported ) { System.out.println("getUsageThreshold\t\t" + memoryPool.getUsageThreshold()); System.out.println("isUsageThresholdExceeded\t\t" + memoryPool.isUsageThresholdExceeded()); System.out.println("getUsageThresholdCount\t\t" + memoryPool.getUsageThresholdCount()); } supported = memoryPool.isCollectionUsageThresholdSupported() ; System.out.println("isCollectionUsageThresholdSupported\t\t" + supported); if ( supported ) { System.out.println("getCollectionUsageThreshold\t\t" + memoryPool.getCollectionUsageThreshold()); System.out.println("getCollectionUsageThresholdCount\t\t" + memoryPool.getCollectionUsageThresholdCount()); System.out.println("isCollectionUsageThresholdExceeded\t\t" + memoryPool.isCollectionUsageThresholdExceeded()); } memoryPool.resetPeakUsage(); } System.out.println("---- OK\n") ; } catch (Exception e) { Utils.printThrowable(e, true) ; errorCount++ ; System.out.println("---- ERROR\n") ; } return errorCount ; }
Example 10
Source File: MemoryUtils.java From reef with Apache License 2.0 | 4 votes |
public static void resetPeakUsage() { final List<MemoryPoolMXBean> memoryPoolMXBeans = ManagementFactory.getMemoryPoolMXBeans(); for (final MemoryPoolMXBean memoryPoolMXBean : memoryPoolMXBeans) { memoryPoolMXBean.resetPeakUsage(); } }
Example 11
Source File: MonteCarloBlackScholesModelAsianOptionSensitivitiesTest.java From finmath-lib with Apache License 2.0 | 4 votes |
private void memoryUsageReset() { for (final MemoryPoolMXBean pool : ManagementFactory.getMemoryPoolMXBeans()) { pool.resetPeakUsage(); } }
Example 12
Source File: MonteCarloBlackScholesModelEuropeanOptionSensitivitiesTest.java From finmath-lib with Apache License 2.0 | 4 votes |
private void memoryUsageReset() { for (final MemoryPoolMXBean pool : ManagementFactory.getMemoryPoolMXBeans()) { pool.resetPeakUsage(); } }
Example 13
Source File: MonteCarloBlackScholesModelAsianOptionSensitivitiesTest.java From finmath-lib with Apache License 2.0 | 4 votes |
private void memoryUsageReset() { for (final MemoryPoolMXBean pool : ManagementFactory.getMemoryPoolMXBeans()) { pool.resetPeakUsage(); } }
Example 14
Source File: MonteCarloBlackScholesModelEuropeanOptionSensitivitiesTest.java From finmath-lib with Apache License 2.0 | 4 votes |
private void memoryUsageReset() { for (final MemoryPoolMXBean pool : ManagementFactory.getMemoryPoolMXBeans()) { pool.resetPeakUsage(); } }