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