< prev index next >

test/hotspot/jtreg/gc/shenandoah/TestJcmdHeapDump.java

Print this page

  1 /*
  2  * Copyright (c) 2021, 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  *

 56  *      TestJcmdHeapDump
 57  *
 58  * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
 59  *      -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive
 60  *      TestJcmdHeapDump
 61  */
 62 
 63 /*
 64  * @test id=adaptive
 65  * @library /test/lib
 66  * @modules jdk.attach/com.sun.tools.attach
 67  * @requires vm.gc.Shenandoah
 68  *
 69  * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
 70  *      -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive
 71  *      -Dtarget=10000
 72  *      TestJcmdHeapDump
 73  */
 74 
 75 /*
 76  * @test id=static
 77  * @library /test/lib
 78  * @modules jdk.attach/com.sun.tools.attach
 79  * @requires vm.gc.Shenandoah
 80  *
 81  * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
 82  *      -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static

 83  *      TestJcmdHeapDump
 84  */
 85 
 86 /*
 87  * @test id=compact
 88  * @library /test/lib
 89  * @modules jdk.attach/com.sun.tools.attach
 90  * @requires vm.gc.Shenandoah
 91  *
 92  * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
 93  *      -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact
 94  *     TestJcmdHeapDump
 95  */
 96 
 97 /*
 98  * @test id=iu-aggressive
 99  * @library /test/lib
100  * @modules jdk.attach/com.sun.tools.attach
101  * @requires vm.gc.Shenandoah
102  *
103  * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
104  *      -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive
105  *      -XX:+ShenandoahOOMDuringEvacALot
106  *      TestJcmdHeapDump
107  *
108  * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
109  *      -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive
110  *      -XX:+ShenandoahAllocFailureALot
111  *      TestJcmdHeapDump
112  *
113  * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
114  *      -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive
115  *      TestJcmdHeapDump
116  */
117 
118 /*
119  * @test id=iu
120  * @requires vm.gc.Shenandoah
121  * @library /test/lib
122  * @modules jdk.attach/com.sun.tools.attach

123  *
124  * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
125  *      -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu
126  *      TestJcmdHeapDump
127  */
128 
129 import jdk.test.lib.JDKToolLauncher;
130 import jdk.test.lib.process.ProcessTools;
131 import jdk.test.lib.process.OutputAnalyzer;
132 
133 import java.io.File;
134 
135 public class TestJcmdHeapDump {
136     public static void main(String[] args) {
137         long pid = ProcessHandle.current().pid();
138         JDKToolLauncher jcmd = JDKToolLauncher.createUsingTestJDK("jcmd");
139         jcmd.addToolArg(String.valueOf(pid));
140         jcmd.addToolArg("GC.heap_dump");
141         String dumpFileName = "myheapdump" + String.valueOf(pid);
142         jcmd.addToolArg(dumpFileName);
143 
144         try {
145             OutputAnalyzer output = ProcessTools.executeProcess(jcmd.getCommand());
146             output.shouldHaveExitValue(0);

  1 /*
  2  * Copyright (c) 2021, 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  *

 57  *      TestJcmdHeapDump
 58  *
 59  * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
 60  *      -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive
 61  *      TestJcmdHeapDump
 62  */
 63 
 64 /*
 65  * @test id=adaptive
 66  * @library /test/lib
 67  * @modules jdk.attach/com.sun.tools.attach
 68  * @requires vm.gc.Shenandoah
 69  *
 70  * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
 71  *      -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive
 72  *      -Dtarget=10000
 73  *      TestJcmdHeapDump
 74  */
 75 
 76 /*
 77  * @test id=generational
 78  * @library /test/lib
 79  * @modules jdk.attach/com.sun.tools.attach
 80  * @requires vm.gc.Shenandoah
 81  *
 82  * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
 83  *      -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive -XX:ShenandoahGCMode=generational
 84  *      -Dtarget=10000
 85  *      TestJcmdHeapDump
 86  */
 87 
 88 /*
 89  * @test id=static











 90  * @library /test/lib
 91  * @modules jdk.attach/com.sun.tools.attach
 92  * @requires vm.gc.Shenandoah
 93  *
 94  * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
 95  *      -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static










 96  *      TestJcmdHeapDump
 97  */
 98 
 99 /*
100  * @test id=compact

101  * @library /test/lib
102  * @modules jdk.attach/com.sun.tools.attach
103  * @requires vm.gc.Shenandoah
104  *
105  * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
106  *      -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact
107  *     TestJcmdHeapDump
108  */
109 
110 import jdk.test.lib.JDKToolLauncher;
111 import jdk.test.lib.process.ProcessTools;
112 import jdk.test.lib.process.OutputAnalyzer;
113 
114 import java.io.File;
115 
116 public class TestJcmdHeapDump {
117     public static void main(String[] args) {
118         long pid = ProcessHandle.current().pid();
119         JDKToolLauncher jcmd = JDKToolLauncher.createUsingTestJDK("jcmd");
120         jcmd.addToolArg(String.valueOf(pid));
121         jcmd.addToolArg("GC.heap_dump");
122         String dumpFileName = "myheapdump" + String.valueOf(pid);
123         jcmd.addToolArg(dumpFileName);
124 
125         try {
126             OutputAnalyzer output = ProcessTools.executeProcess(jcmd.getCommand());
127             output.shouldHaveExitValue(0);
< prev index next >