< prev index next >

test/gc/shenandoah/mxbeans/TestPauseNotifications.java

Print this page
rev 10790 : [backport] Prefix Shenandoah tests with "Test"

*** 1,7 **** /* ! * Copyright (c) 2018, Red Hat, Inc. and/or its affiliates. * * 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) 2018, Red Hat, Inc. All rights reserved. * * 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,50 **** * questions. * */ /* ! * @test PauseNotifications * @summary Check that MX notifications are reported for all cycles * ! * @run main/othervm -Xmx128m -XX:+UseShenandoahGC -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:ShenandoahGCHeuristics=passive -XX:+ShenandoahDegeneratedGC PauseNotifications ! * @run main/othervm -Xmx128m -XX:+UseShenandoahGC -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:ShenandoahGCHeuristics=passive -XX:-ShenandoahDegeneratedGC PauseNotifications * ! * @run main/othervm -Xmx128m -XX:+UseShenandoahGC -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:ShenandoahGCHeuristics=aggressive PauseNotifications * ! * @run main/othervm -Xmx128m -XX:+UseShenandoahGC -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:ShenandoahGCHeuristics=adaptive PauseNotifications ! * @run main/othervm -Xmx128m -XX:+UseShenandoahGC -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:ShenandoahGCHeuristics=static PauseNotifications ! * @run main/othervm -Xmx128m -XX:+UseShenandoahGC -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:ShenandoahGCHeuristics=compact PauseNotifications */ import java.util.*; import java.util.concurrent.atomic.*; import javax.management.*; import java.lang.management.*; import javax.management.openmbean.*; import com.sun.management.GarbageCollectionNotificationInfo; ! public class PauseNotifications { static final long HEAP_MB = 128; // adjust for test configuration above static final long TARGET_MB = Long.getLong("target", 8_000); // 8 Gb allocation static volatile Object sink; --- 20,51 ---- * questions. * */ /* ! * @test TestPauseNotifications * @summary Check that MX notifications are reported for all cycles + * @key gc * ! * @run main/othervm -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=passive -XX:+ShenandoahDegeneratedGC TestPauseNotifications ! * @run main/othervm -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=passive -XX:-ShenandoahDegeneratedGC TestPauseNotifications * ! * @run main/othervm -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive TestPauseNotifications * ! * @run main/othervm -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive TestPauseNotifications ! * @run main/othervm -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static TestPauseNotifications ! * @run main/othervm -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact TestPauseNotifications */ import java.util.*; import java.util.concurrent.atomic.*; import javax.management.*; import java.lang.management.*; import javax.management.openmbean.*; import com.sun.management.GarbageCollectionNotificationInfo; ! public class TestPauseNotifications { static final long HEAP_MB = 128; // adjust for test configuration above static final long TARGET_MB = Long.getLong("target", 8_000); // 8 Gb allocation static volatile Object sink;
*** 55,65 **** NotificationListener listener = new NotificationListener() { @Override public void handleNotification(Notification n, Object o) { if (n.getType().equals(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION)) { ! GarbageCollectionNotificationInfo info = GarbageCollectionNotificationInfo.from((CompositeData)n.getUserData()); long d = info.getGcInfo().getDuration(); String name = info.getGcName(); if (name.contains("Shenandoah")) { --- 56,66 ---- NotificationListener listener = new NotificationListener() { @Override public void handleNotification(Notification n, Object o) { if (n.getType().equals(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION)) { ! GarbageCollectionNotificationInfo info = GarbageCollectionNotificationInfo.from((CompositeData) n.getUserData()); long d = info.getGcInfo().getDuration(); String name = info.getGcName(); if (name.contains("Shenandoah")) {
*** 78,88 **** for (GarbageCollectorMXBean bean : ManagementFactory.getGarbageCollectorMXBeans()) { ((NotificationEmitter) bean).addNotificationListener(listener, null, null); } final int size = 100_000; ! long count = TARGET_MB * 1024 * 1024 / (16 + 4*size); for (int c = 0; c < count; c++) { sink = new int[size]; } --- 79,89 ---- for (GarbageCollectorMXBean bean : ManagementFactory.getGarbageCollectorMXBeans()) { ((NotificationEmitter) bean).addNotificationListener(listener, null, null); } final int size = 100_000; ! long count = TARGET_MB * 1024 * 1024 / (16 + 4 * size); for (int c = 0; c < count; c++) { sink = new int[size]; }
*** 120,126 **** throw new IllegalStateException(msg); } } } } - - --- 121,125 ----
< prev index next >