< prev index next >

test/gc/cms/TestMBeanCMS.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 20,71 **** * or visit www.oracle.com if you need additional information or have any * questions. */ /* ! * @test Test6581734.java * @bug 6581734 * @requires vm.gc=="ConcMarkSweep" | vm.gc=="null" * @summary CMS Old Gen's collection usage is zero after GC which is incorrect * @modules java.management ! * @run main/othervm -Xmx512m -verbose:gc -XX:+UseConcMarkSweepGC Test6581734 * */ - import java.util.*; - import java.lang.management.*; // 6581734 states that memory pool usage via the mbean is wrong // for CMS (zero, even after a collection). // // 6580448 states that the collection count similarly is wrong // (stays at zero for CMS collections) // -- closed as dup of 6581734 as the same fix resolves both. ! public class Test6581734 { private String poolName = "CMS"; private String collectorName = "ConcurrentMarkSweep"; public static void main(String [] args) { ! Test6581734 t = null; if (args.length==2) { ! t = new Test6581734(args[0], args[1]); } else { System.out.println("Defaulting to monitor CMS pool and collector."); ! t = new Test6581734(); } t.run(); } ! public Test6581734(String pool, String collector) { poolName = pool; collectorName = collector; } ! public Test6581734() { } public void run() { // Use some memory, enough that we expect collections should // have happened. --- 20,75 ---- * or visit www.oracle.com if you need additional information or have any * questions. */ /* ! * @test TestMBeanCMS.java * @bug 6581734 * @requires vm.gc=="ConcMarkSweep" | vm.gc=="null" * @summary CMS Old Gen's collection usage is zero after GC which is incorrect * @modules java.management ! * @run main/othervm -Xmx512m -verbose:gc -XX:+UseConcMarkSweepGC TestMBeanCMS * */ + import java.lang.management.GarbageCollectorMXBean; + import java.lang.management.ManagementFactory; + import java.lang.management.MemoryPoolMXBean; + import java.util.LinkedList; + import java.util.List; + // 6581734 states that memory pool usage via the mbean is wrong // for CMS (zero, even after a collection). // // 6580448 states that the collection count similarly is wrong // (stays at zero for CMS collections) // -- closed as dup of 6581734 as the same fix resolves both. ! public class TestMBeanCMS { private String poolName = "CMS"; private String collectorName = "ConcurrentMarkSweep"; public static void main(String [] args) { ! TestMBeanCMS t = null; if (args.length==2) { ! t = new TestMBeanCMS(args[0], args[1]); } else { System.out.println("Defaulting to monitor CMS pool and collector."); ! t = new TestMBeanCMS(); } t.run(); } ! public TestMBeanCMS(String pool, String collector) { poolName = pool; collectorName = collector; } ! public TestMBeanCMS() { } public void run() { // Use some memory, enough that we expect collections should // have happened.
< prev index next >