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 *
66 * @summary Check that MX notifications are reported for all cycles
67 * @library /test/lib /
68 * @requires vm.gc.Shenandoah
69 *
70 * @run main/othervm -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
71 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static
72 * TestPauseNotifications
73 */
74
75 /*
76 * @test id=compact
77 * @summary Check that MX notifications are reported for all cycles
78 * @library /test/lib /
79 * @requires vm.gc.Shenandoah
80 *
81 * @run main/othervm -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
82 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact
83 * TestPauseNotifications
84 */
85
86 import java.util.*;
87 import java.util.concurrent.atomic.*;
88 import javax.management.*;
89 import java.lang.management.*;
90 import javax.management.openmbean.*;
91
92 import jdk.test.lib.Utils;
93
94 import com.sun.management.GarbageCollectionNotificationInfo;
95
96 public class TestPauseNotifications {
97
98 static final long HEAP_MB = 128; // adjust for test configuration above
99 static final long TARGET_MB = Long.getLong("target", 2_000); // 2 Gb allocation
100
101 static volatile Object sink;
102
103 private static boolean isExpectedPauseAction(String action) {
104 return "Init Mark".equals(action) || "Final Mark".equals(action) || "Full GC".equals(action)
105 || "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 *
67 * @summary Check that MX notifications are reported for all cycles
68 * @library /test/lib /
69 * @requires vm.gc.Shenandoah
70 *
71 * @run main/othervm -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
72 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static
73 * TestPauseNotifications
74 */
75
76 /*
77 * @test id=compact
78 * @summary Check that MX notifications are reported for all cycles
79 * @library /test/lib /
80 * @requires vm.gc.Shenandoah
81 *
82 * @run main/othervm -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
83 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact
84 * TestPauseNotifications
85 */
86
87 /*
88 * @test id=generational
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=generational
95 * TestPauseNotifications
96 */
97
98 import java.util.*;
99 import java.util.concurrent.atomic.*;
100 import javax.management.*;
101 import java.lang.management.*;
102 import javax.management.openmbean.*;
103
104 import jdk.test.lib.Utils;
105
106 import com.sun.management.GarbageCollectionNotificationInfo;
107
108 public class TestPauseNotifications {
109
110 static final long HEAP_MB = 128; // adjust for test configuration above
111 static final long TARGET_MB = Long.getLong("target", 2_000); // 2 Gb allocation
112
113 static volatile Object sink;
114
115 private static boolean isExpectedPauseAction(String action) {
116 return "Init Mark".equals(action) || "Final Mark".equals(action) || "Full GC".equals(action)
117 || "Degenerated GC".equals(action) || "Init Update Refs".equals(action)
|