1 /* 2 * Copyright (c) 2017, 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 * 24 */ 25 26 /* 27 * @test id=passive 28 * @requires vm.gc.Shenandoah 29 * 30 * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 31 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive 32 * -XX:+ShenandoahDegeneratedGC 33 * -Dtarget=10000 34 * TestLotsOfCycles 35 * 36 * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 37 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive 38 * -XX:-ShenandoahDegeneratedGC 39 * -Dtarget=10000 40 * TestLotsOfCycles 41 */ 42 43 /* 44 * @test id=aggressive 45 * @requires vm.gc.Shenandoah 46 * 47 * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 48 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 49 * -XX:+ShenandoahOOMDuringEvacALot 50 * -Dtarget=1000 51 * TestLotsOfCycles 52 * 53 * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 54 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 55 * -XX:+ShenandoahAllocFailureALot 56 * -Dtarget=1000 57 * TestLotsOfCycles 58 * 59 * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 60 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 61 * -Dtarget=1000 62 * TestLotsOfCycles 63 */ 64 65 /* 66 * @test id=adaptive 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 * TestLotsOfCycles 73 */ 74 75 /* 76 * @test id=generational 77 * @requires vm.gc.Shenandoah 78 * 79 * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 80 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive -XX:ShenandoahGCMode=generational 81 * -Dtarget=10000 82 * TestLotsOfCycles 83 */ 84 85 /* 86 * @test id=static 87 * @requires vm.gc.Shenandoah 88 * 89 * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 90 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static 91 * -Dtarget=10000 92 * TestLotsOfCycles 93 */ 94 95 /* 96 * @test id=compact 97 * @requires vm.gc.Shenandoah 98 * 99 * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 100 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact 101 * -Dtarget=1000 102 * TestLotsOfCycles 103 */ 104 105 public class TestLotsOfCycles { 106 107 static final long TARGET_MB = Long.getLong("target", 10_000); // 10 Gb allocation, around 1K cycles to handle 108 static final long STRIDE = 100_000; 109 110 static volatile Object sink; 111 112 public static void main(String[] args) throws Exception { 113 long count = TARGET_MB * 1024 * 1024 / 16; 114 for (long c = 0; c < count; c += STRIDE) { 115 for (long s = 0; s < STRIDE; s++) { 116 sink = new Object(); 117 } 118 Thread.sleep(1); 119 } 120 } 121 122 }