38
39 public class TestObjItrWithHeapDump {
40 public static void testWith(String... args) throws Exception {
41 String[] cmds = Arrays.copyOf(args, args.length + 2);
42 cmds[args.length] = TestObjItrWithHeapDump.class.getName();
43 cmds[args.length + 1] = "test";
44 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(cmds);
45
46 OutputAnalyzer output = new OutputAnalyzer(pb.start());
47 output.shouldHaveExitValue(0);
48 output.shouldContain("Class Histogram (before full gc)");
49 output.shouldContain("Class Histogram (after full gc)");
50 }
51
52 public static void main(String[] args) throws Exception {
53 if (args.length > 0 && args[0].equals("test")) {
54 System.gc();
55 System.exit(0);
56 }
57
58 String[] heuristics = new String[] {
59 "adaptive",
60 "compact",
61 "static",
62 "aggressive",
63 "passive",
64 "traversal",
65 };
66
67 for (String h : heuristics) {
68 testWith("-XX:+UnlockDiagnosticVMOptions",
69 "-XX:+UnlockExperimentalVMOptions",
70 "-XX:+UseShenandoahGC",
71 "-XX:-ShenandoahDegeneratedGC",
72 "-XX:ShenandoahGCHeuristics=" + h,
73 "-Xlog:gc+classhisto=trace",
74 "-XX:-ExplicitGCInvokesConcurrent",
75 "-Xmx512M"
76 );
77 }
78 }
79 }
|
38
39 public class TestObjItrWithHeapDump {
40 public static void testWith(String... args) throws Exception {
41 String[] cmds = Arrays.copyOf(args, args.length + 2);
42 cmds[args.length] = TestObjItrWithHeapDump.class.getName();
43 cmds[args.length + 1] = "test";
44 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(cmds);
45
46 OutputAnalyzer output = new OutputAnalyzer(pb.start());
47 output.shouldHaveExitValue(0);
48 output.shouldContain("Class Histogram (before full gc)");
49 output.shouldContain("Class Histogram (after full gc)");
50 }
51
52 public static void main(String[] args) throws Exception {
53 if (args.length > 0 && args[0].equals("test")) {
54 System.gc();
55 System.exit(0);
56 }
57
58 String[][][] modeHeuristics = new String[][][] {
59 {{"normal"}, {
60 "adaptive",
61 "compact",
62 "static",
63 "aggressive"}},
64 {{"traversal"}, {"adaptive"}},
65 {{"passive"}, {"passive"}}
66 };
67
68 for (String[][] mh : modeHeuristics) {
69 String mode = mh[0][0];
70 String[] heuristics = mh[1];
71 for (String h : heuristics) {
72 testWith("-XX:+UnlockDiagnosticVMOptions",
73 "-XX:+UnlockExperimentalVMOptions",
74 "-XX:+UseShenandoahGC",
75 "-XX:-ShenandoahDegeneratedGC",
76 "-XX:ShenandoahGCMode=" + mode,
77 "-XX:ShenandoahGCHeuristics=" + h,
78 "-Xlog:gc+classhisto=trace",
79 "-XX:-ExplicitGCInvokesConcurrent",
80 "-Xmx512M"
81 );
82 }
83 }
84 }
85 }
|