Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/gc/shenandoah/TestObjItrWithHeapDump.java
32284 views
/*1* Copyright (c) 2019, Red Hat, Inc. All rights reserved.2*3* This code is free software; you can redistribute it and/or modify it4* under the terms of the GNU General Public License version 2 only, as5* published by the Free Software Foundation.6*7* This code is distributed in the hope that it will be useful, but WITHOUT8* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or9* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License10* version 2 for more details (a copy is included in the LICENSE file that11* accompanied this code).12*13* You should have received a copy of the GNU General Public License version14* 2 along with this work; if not, write to the Free Software Foundation,15* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.16*17* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA18* or visit www.oracle.com if you need additional information or have any19* questions.20*21*/2223/*24* @test TestObjIterWithHeapDump25* @summary Test heap dump triggered heap object iteration26* @key gc27* @bug 822501428* @library /testlibrary29* @run main/othervm TestObjItrWithHeapDump30*/3132import java.util.*;33import com.oracle.java.testlibrary.*;3435public class TestObjItrWithHeapDump {36public static void testWith(String... args) throws Exception {37String[] cmds = Arrays.copyOf(args, args.length + 2);38cmds[args.length] = TestObjItrWithHeapDump.class.getName();39cmds[args.length + 1] = "test";40ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(cmds);4142OutputAnalyzer output = new OutputAnalyzer(pb.start());43output.shouldHaveExitValue(0);44output.shouldContain("Class Histogram (before full gc)");45output.shouldContain("Class Histogram (after full gc)");46}4748public static void main(String[] args) throws Exception {49if (args.length > 0 && args[0].equals("test")) {50System.gc();51System.exit(0);52}5354String[][][] modeHeuristics = new String[][][]{55{{"satb"}, {"adaptive", "compact", "static", "aggressive"}},56{{"iu"}, {"adaptive", "aggressive"}},57{{"passive"}, {"passive"}}58};5960for (String[][] mh : modeHeuristics) {61String mode = mh[0][0];62String[] heuristics = mh[1];63for (String h : heuristics) {64testWith("-XX:+UnlockDiagnosticVMOptions",65"-XX:+UnlockExperimentalVMOptions",66"-XX:+UseShenandoahGC",67"-XX:-ShenandoahDegeneratedGC",68"-XX:ShenandoahGCMode=" + mode,69"-XX:ShenandoahGCHeuristics=" + h,70"-XX:+PrintClassHistogramBeforeFullGC",71"-XX:+PrintClassHistogramAfterFullGC",72"-XX:+PrintGCDetails",73"-XX:-ExplicitGCInvokesConcurrent",74"-Xmx512M"75);76}77}78}79}808182