1 /*
2 * Copyright (c) 2018, Red Hat, Inc. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
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 *
81 * @run main/othervm -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
82 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact
83 * TestPauseNotifications
84 */
85
86 /*
87 * @test id=iu
88 * @summary Check that MX notifications are reported for all cycles
89 * @library /test/lib /
90 * @requires vm.gc.Shenandoah
91 *
92 * @run main/othervm -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
93 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive
94 * TestPauseNotifications
95 *
96 * @run main/othervm -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
97 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu
98 * TestPauseNotifications
99 */
100
101 import java.util.*;
102 import java.util.concurrent.atomic.*;
103 import javax.management.*;
104 import java.lang.management.*;
105 import javax.management.openmbean.*;
106
107 import jdk.test.lib.Utils;
108
109 import com.sun.management.GarbageCollectionNotificationInfo;
110
111 public class TestPauseNotifications {
112
113 static final long HEAP_MB = 128; // adjust for test configuration above
114 static final long TARGET_MB = Long.getLong("target", 2_000); // 2 Gb allocation
115
116 static volatile Object sink;
117
118 private static boolean isExpectedPauseAction(String action) {
119 return "Init Mark".equals(action) || "Final Mark".equals(action) || "Full GC".equals(action)
120 || "Degenerated GC".equals(action) || "Init Update Refs".equals(action)
|
1 /*
2 * Copyright (c) 2018, Red Hat, Inc. All rights reserved.
3 * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
82 * @run main/othervm -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
83 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact
84 * TestPauseNotifications
85 */
86
87 /*
88 * @test id=iu
89 * @summary Check that MX notifications are reported for all cycles
90 * @library /test/lib /
91 * @requires vm.gc.Shenandoah
92 *
93 * @run main/othervm -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
94 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive
95 * TestPauseNotifications
96 *
97 * @run main/othervm -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
98 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu
99 * TestPauseNotifications
100 */
101
102 /*
103 * @test id=generational
104 * @summary Check that MX notifications are reported for all cycles
105 * @library /test/lib /
106 * @requires vm.gc.Shenandoah
107 *
108 * @run main/othervm -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
109 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=generational
110 * TestPauseNotifications
111 */
112
113 import java.util.*;
114 import java.util.concurrent.atomic.*;
115 import javax.management.*;
116 import java.lang.management.*;
117 import javax.management.openmbean.*;
118
119 import jdk.test.lib.Utils;
120
121 import com.sun.management.GarbageCollectionNotificationInfo;
122
123 public class TestPauseNotifications {
124
125 static final long HEAP_MB = 128; // adjust for test configuration above
126 static final long TARGET_MB = Long.getLong("target", 2_000); // 2 Gb allocation
127
128 static volatile Object sink;
129
130 private static boolean isExpectedPauseAction(String action) {
131 return "Init Mark".equals(action) || "Final Mark".equals(action) || "Full GC".equals(action)
132 || "Degenerated GC".equals(action) || "Init Update Refs".equals(action)
|