Path: blob/master/test/hotspot/jtreg/gc/shenandoah/TestGCThreadGroups.java
40942 views
/*1* Copyright (c) 2017, 2020, Red Hat, Inc. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324/**25* @test TestGCThreadGroups26* @summary Test Shenandoah GC uses concurrent/parallel threads correctly27* @requires vm.gc.Shenandoah28*29* @run main/othervm -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions30* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive31* -XX:ConcGCThreads=2 -XX:ParallelGCThreads=432* -Dtarget=100033* TestGCThreadGroups34*/3536/**37* @test TestGCThreadGroups38* @summary Test Shenandoah GC uses concurrent/parallel threads correctly39* @requires vm.gc.Shenandoah40*41* @run main/othervm -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions42* -XX:+UseShenandoahGC43* -XX:ConcGCThreads=2 -XX:ParallelGCThreads=444* -Dtarget=100045* TestGCThreadGroups46*47* @run main/othervm -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions48* -XX:+UseShenandoahGC49* -XX:-UseDynamicNumberOfGCThreads50* -Dtarget=100051* TestGCThreadGroups52*53* @run main/othervm -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions54* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive55* -XX:ConcGCThreads=2 -XX:ParallelGCThreads=456* -Dtarget=100057* TestGCThreadGroups58*59* @run main/othervm -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions60* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static61* -XX:ConcGCThreads=2 -XX:ParallelGCThreads=462* -Dtarget=100063* TestGCThreadGroups64*65* @run main/othervm -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions66* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact67* -XX:ConcGCThreads=2 -XX:ParallelGCThreads=468* -Dtarget=10069* TestGCThreadGroups70*71* @run main/othervm -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions72* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive73* -XX:ConcGCThreads=2 -XX:ParallelGCThreads=474* -Dtarget=10075* TestGCThreadGroups76*/7778/**79* @test TestGCThreadGroups80* @summary Test Shenandoah GC uses concurrent/parallel threads correctly81* @requires vm.gc.Shenandoah82*83* @run main/othervm -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions84* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu85* -XX:ConcGCThreads=2 -XX:ParallelGCThreads=486* -Dtarget=100087* TestGCThreadGroups88*89* @run main/othervm -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions90* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive91* -XX:ConcGCThreads=2 -XX:ParallelGCThreads=492* -Dtarget=100093* TestGCThreadGroups94*/9596public class TestGCThreadGroups {9798static final long TARGET_MB = Long.getLong("target", 10_000); // 10 Gb allocation, around 1K cycles to handle99static final long STRIDE = 100_000;100101static volatile Object sink;102103public static void main(String[] args) throws Exception {104long count = TARGET_MB * 1024 * 1024 / 16;105for (long c = 0; c < count; c += STRIDE) {106for (long s = 0; s < STRIDE; s++) {107sink = new Object();108}109Thread.sleep(1);110}111}112113}114115116