1 /*
2 * Copyright (c) 2017, 2020, 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 *
46 * @run main/othervm/native/timeout=300 -agentlib:TestHeapDump
47 * -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
48 * -XX:+UseShenandoahGC -Xmx128m
49 * -XX:ShenandoahGCHeuristics=aggressive
50 * -XX:-UseCompressedOops TestHeapDump
51 */
52
53 /**
54 * @test id=aggressive-strdedup
55 * @summary Tests JVMTI heap dumps
56 * @requires vm.gc.Shenandoah
57 * @requires vm.jvmti
58 * @compile TestHeapDump.java
59 * @run main/othervm/native/timeout=300 -agentlib:TestHeapDump
60 * -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
61 * -XX:+UseShenandoahGC -Xmx128m
62 * -XX:ShenandoahGCHeuristics=aggressive
63 * -XX:+UseStringDeduplication TestHeapDump
64 */
65
66 import java.lang.ref.Reference;
67
68 public class TestHeapDump {
69
70 private static final int NUM_ITER = 10000;
71
72 private static final int ARRAY_SIZE = 1000;
73
74 private static final int EXPECTED_OBJECTS =
75 ARRAY_SIZE + // array reachable from instance field
76 1 + // static field root
77 1; // local field root
78
79 static {
80 try {
81 System.loadLibrary("TestHeapDump");
82 } catch (UnsatisfiedLinkError ule) {
83 System.err.println("Could not load TestHeapDump library");
84 System.err.println("java.library.path: "
85 + System.getProperty("java.library.path"));
|
1 /*
2 * Copyright (c) 2017, 2020, 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 *
47 * @run main/othervm/native/timeout=300 -agentlib:TestHeapDump
48 * -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
49 * -XX:+UseShenandoahGC -Xmx128m
50 * -XX:ShenandoahGCHeuristics=aggressive
51 * -XX:-UseCompressedOops TestHeapDump
52 */
53
54 /**
55 * @test id=aggressive-strdedup
56 * @summary Tests JVMTI heap dumps
57 * @requires vm.gc.Shenandoah
58 * @requires vm.jvmti
59 * @compile TestHeapDump.java
60 * @run main/othervm/native/timeout=300 -agentlib:TestHeapDump
61 * -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
62 * -XX:+UseShenandoahGC -Xmx128m
63 * -XX:ShenandoahGCHeuristics=aggressive
64 * -XX:+UseStringDeduplication TestHeapDump
65 */
66
67 /**
68 * @test id=generational
69 * @summary Tests JVMTI heap dumps
70 * @requires vm.gc.Shenandoah
71 * @requires vm.jvmti
72 * @compile TestHeapDump.java
73 * @run main/othervm/native/timeout=300 -agentlib:TestHeapDump
74 * -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
75 * -XX:+UseShenandoahGC -Xmx128m
76 * -XX:ShenandoahGCMode=generational
77 * TestHeapDump
78 *
79 */
80
81 /**
82 * @test id=no-coops-generational
83 * @summary Tests JVMTI heap dumps
84 * @requires vm.gc.Shenandoah
85 * @requires vm.jvmti
86 * @requires vm.bits == "64"
87 * @compile TestHeapDump.java
88 * @run main/othervm/native/timeout=300 -agentlib:TestHeapDump
89 * -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
90 * -XX:+UseShenandoahGC -Xmx128m
91 * -XX:ShenandoahGCMode=generational
92 * -XX:-UseCompressedOops TestHeapDump
93 */
94
95 /**
96 * @test id=generational-strdedup
97 * @summary Tests JVMTI heap dumps
98 * @requires vm.gc.Shenandoah
99 * @requires vm.jvmti
100 * @compile TestHeapDump.java
101 * @run main/othervm/native/timeout=300 -agentlib:TestHeapDump
102 * -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
103 * -XX:+UseShenandoahGC -Xmx128m
104 * -XX:ShenandoahGCMode=generational
105 * -XX:+UseStringDeduplication TestHeapDump
106 */
107 import java.lang.ref.Reference;
108
109 public class TestHeapDump {
110
111 private static final int NUM_ITER = 10000;
112
113 private static final int ARRAY_SIZE = 1000;
114
115 private static final int EXPECTED_OBJECTS =
116 ARRAY_SIZE + // array reachable from instance field
117 1 + // static field root
118 1; // local field root
119
120 static {
121 try {
122 System.loadLibrary("TestHeapDump");
123 } catch (UnsatisfiedLinkError ule) {
124 System.err.println("Could not load TestHeapDump library");
125 System.err.println("java.library.path: "
126 + System.getProperty("java.library.path"));
|