1 /*
   2  * Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved.
   3  *
   4  * This code is free software; you can redistribute it and/or modify it
   5  * under the terms of the GNU General Public License version 2 only, as
   6  * published by the Free Software Foundation.
   7  *
   8  * This code is distributed in the hope that it will be useful, but WITHOUT
   9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  11  * version 2 for more details (a copy is included in the LICENSE file that
  12  * accompanied this code).
  13  *
  14  * You should have received a copy of the GNU General Public License version
  15  * 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 USA
  19  * or visit www.oracle.com if you need additional information or have any
  20  * questions.
  21  *
  22  */
  23 
  24 /*
  25  * @test TestRegionSampling
  26  * @key gc
  27  *
  28  * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+ShenandoahRegionSampling
  29  *      -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive
  30  *      -XX:+ShenandoahDegeneratedGC
  31  *      TestRegionSampling
  32  *
  33  * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+ShenandoahRegionSampling
  34  *      -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive
  35  *      -XX:-ShenandoahDegeneratedGC
  36  *      TestRegionSampling
  37  */
  38 
  39 /*
  40  * @test TestRegionSampling
  41  * @key gc
  42  *
  43  * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+ShenandoahRegionSampling
  44  *      -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive
  45  *      TestRegionSampling
  46  */
  47 
  48 /*
  49  * @test TestRegionSampling
  50  * @key gc
  51  *
  52  * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+ShenandoahRegionSampling
  53  *      -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static
  54  *      TestRegionSampling
  55  */
  56 
  57 /*
  58  * @test TestRegionSampling
  59  * @key gc
  60  *
  61  * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+ShenandoahRegionSampling
  62  *      -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact
  63  *      TestRegionSampling
  64  */
  65 
  66 /*
  67  * @test TestRegionSampling
  68  * @key gc
  69  *
  70  * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+ShenandoahRegionSampling
  71  *      -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive
  72  *      TestRegionSampling
  73  */
  74 
  75 /*
  76  * @test TestRegionSampling
  77  * @key gc
  78  *
  79  * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+ShenandoahRegionSampling
  80  *      -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive
  81  *      TestRegionSampling
  82  */
  83 
  84 /*
  85  * @test TestRegionSampling
  86  * @key gc
  87  *
  88  * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+ShenandoahRegionSampling
  89  *      -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu
  90  *      TestRegionSampling
  91  *
  92  */
  93 
  94 public class TestRegionSampling {
  95 
  96     static final long TARGET_MB = Long.getLong("target", 2_000); // 2 Gb allocation
  97 
  98     static volatile Object sink;
  99 
 100     public static void main(String[] args) throws Exception {
 101         long count = TARGET_MB * 1024 * 1024 / 16;
 102         for (long c = 0; c < count; c++) {
 103             sink = new Object();
 104         }
 105     }
 106 
 107 }