17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 package gc; 25 26 import java.util.List; 27 import java.lang.management.*; 28 import static jdk.test.lib.Asserts.*; 29 import java.util.stream.*; 30 31 /* @test TestMemoryMXBeansAndPoolsPresence 32 * @bug 8191564 33 * @summary Tests that GarbageCollectorMXBeans and GC MemoryPools are created. 34 * @library /test/lib 35 * @modules java.base/jdk.internal.misc 36 * java.management 37 * @requires vm.gc == null 38 * @run main/othervm -XX:+UseG1GC gc.TestMemoryMXBeansAndPoolsPresence G1 39 * @run main/othervm -XX:+UseParallelGC gc.TestMemoryMXBeansAndPoolsPresence Parallel 40 * @run main/othervm -XX:+UseSerialGC gc.TestMemoryMXBeansAndPoolsPresence Serial 41 */ 42 43 /* @test TestMemoryMXBeansAndPoolsPresenceCMS 44 * @bug 8191564 45 * @library /test/lib 46 * @modules java.base/jdk.internal.misc 47 * java.management 48 * @comment Graal does not support CMS 49 * @requires vm.gc == null & !vm.graal.enabled 50 * @run main/othervm -XX:+UseConcMarkSweepGC gc.TestMemoryMXBeansAndPoolsPresence CMS 51 */ 52 53 class GCBeanDescription { 54 public String name; 55 public String[] poolNames; 56 57 public GCBeanDescription(String name, String[] poolNames) { 58 this.name = name; 59 this.poolNames = poolNames; 60 } 61 } 62 63 public class TestMemoryMXBeansAndPoolsPresence { 64 public static void test(GCBeanDescription... expectedBeans) { 65 List<MemoryPoolMXBean> memoryPools = ManagementFactory.getMemoryPoolMXBeans(); 66 67 List<GarbageCollectorMXBean> gcBeans = ManagementFactory.getGarbageCollectorMXBeans(); 68 assertEQ(expectedBeans.length, gcBeans.size()); 69 | 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 package gc; 25 26 import java.util.List; 27 import java.lang.management.*; 28 import static jdk.test.lib.Asserts.*; 29 import java.util.stream.*; 30 31 /* @test TestMemoryMXBeansAndPoolsPresence 32 * @bug 8191564 33 * @summary Tests that GarbageCollectorMXBeans and GC MemoryPools are created. 34 * @library /test/lib 35 * @modules java.base/jdk.internal.misc 36 * java.management 37 * @requires vm.gc.Serial & vm.gc.Parallel & vm.gc.G1 38 * @run main/othervm -XX:+UseG1GC gc.TestMemoryMXBeansAndPoolsPresence G1 39 * @run main/othervm -XX:+UseParallelGC gc.TestMemoryMXBeansAndPoolsPresence Parallel 40 * @run main/othervm -XX:+UseSerialGC gc.TestMemoryMXBeansAndPoolsPresence Serial 41 */ 42 43 /* @test TestMemoryMXBeansAndPoolsPresenceCMS 44 * @bug 8191564 45 * @library /test/lib 46 * @modules java.base/jdk.internal.misc 47 * java.management 48 * @comment Graal does not support CMS 49 * @requires vm.gc.ConcMarkSweep & !vm.graal.enabled 50 * @run main/othervm -XX:+UseConcMarkSweepGC gc.TestMemoryMXBeansAndPoolsPresence CMS 51 */ 52 53 class GCBeanDescription { 54 public String name; 55 public String[] poolNames; 56 57 public GCBeanDescription(String name, String[] poolNames) { 58 this.name = name; 59 this.poolNames = poolNames; 60 } 61 } 62 63 public class TestMemoryMXBeansAndPoolsPresence { 64 public static void test(GCBeanDescription... expectedBeans) { 65 List<MemoryPoolMXBean> memoryPools = ManagementFactory.getMemoryPoolMXBeans(); 66 67 List<GarbageCollectorMXBean> gcBeans = ManagementFactory.getGarbageCollectorMXBeans(); 68 assertEQ(expectedBeans.length, gcBeans.size()); 69 |