< prev index next >

test/hotspot/jtreg/vmTestbase/gc/memory/LargePagesTest/LargePagesTest.java

Print this page
rev 59093 : [mq]: randomness-code_vmTestbase_gc


  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @key stress gc
  27  *
  28  * @summary converted from VM Testbase gc/memory/LargePagesTest.
  29  * VM Testbase keywords: [gc, stress, stressopt]
  30  *
  31  * @library /vmTestbase
  32  *          /test/lib
  33  * @run driver jdk.test.lib.FileInstaller . .
  34  * @run main/othervm gc.memory.LargePagesTest.LargePagesTest noThreads=5 duration=60
  35  */
  36 
  37 package gc.memory.LargePagesTest;
  38 
  39 import java.io.PrintStream;
  40 import java.util.Random;
  41 
  42 /*
  43  * Allocators purpose is to create pressure on the garbage collector
  44  * for a certain amount of time.
  45  * Note: this test moved from the "jr", the original name is func.vm.largepages.LargePagesTest
  46  */
  47 
  48 
  49 /**
  50  * @run main/othervm/timeout=150
  51  *      -XX:+UseLargePages
  52  *      -Xmx64m
  53  *      -Xms16m
  54  *      LargePagesTest
  55  *      noThreads=5 duration=60
  56  * @summary heap shrink/grow test
  57  */
  58 final public class LargePagesTest extends Thread {
  59 
  60     private static int cnt;


 141         }
 142         if (verbose) {
 143             out.println("");
 144         }
 145 
 146 
 147         long endTime = System.currentTimeMillis();
 148         long runTime = endTime - startTime;
 149         if (duration > runTime) {
 150             out.println(getName() + "  FAILED: Execution time < requested execution time.");
 151             out.println("                execution time is " + runTime);
 152             out.println("                requested time is " + duration);
 153         } else if (iterations <= 0) {
 154             out.println(getName() + "  FAILED: No executions finished");
 155         } else {
 156             result = true;
 157         }
 158     }
 159 
 160     private void allocate() {
 161 
 162         Random r = new Random();
 163         for (int j = 0; j < 1000; j++) {
 164             r = new Random();
 165             int i = 0;
 166 
 167             switch (myType) {
 168             case SMALL_OBJECT_ALLOCATER:
 169                 i = 5;
 170                 break;
 171             case LARGE_OBJECT_ALLOCATER:
 172                 i = 1;
 173                 break;
 174             case ANY_OBJECT_ALLOCATER:
 175                 i = r.nextInt(100);
 176                 break;
 177             case ANY_NO_MULTIARRAYS_ALLOCATER:
 178                 i = r.nextInt(100);
 179                 if ((i >= 2) && (i <= 4)) {
 180                     i = 5;
 181                 }
 182                 break;
 183             default:
 184                 break;
 185             }
 186 
 187             switch (i) {
 188             case 0:
 189                 d0 = new LargePagesTest.Dummy[10];
 190                 break;
 191             case 1:
 192                 d1 = new LargePagesTest.Dummy[1000];
 193                 break;
 194             case 2:
 195                 d2 = new LargePagesTest.Dummy[10][10];
 196                 break;
 197             case 3:
 198                 d3 = new LargePagesTest.Dummy[100][100];




  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @key stress gc
  27  *
  28  * @summary converted from VM Testbase gc/memory/LargePagesTest.
  29  * VM Testbase keywords: [gc, stress, stressopt]
  30  *
  31  * @library /vmTestbase
  32  *          /test/lib
  33  * @run driver jdk.test.lib.FileInstaller . .
  34  * @run main/othervm gc.memory.LargePagesTest.LargePagesTest noThreads=5 duration=60
  35  */
  36 
  37 package gc.memory.LargePagesTest;
  38 
  39 import java.io.PrintStream;
  40 import nsk.share.test.LocalRandom;
  41 
  42 /*
  43  * Allocators purpose is to create pressure on the garbage collector
  44  * for a certain amount of time.
  45  * Note: this test moved from the "jr", the original name is func.vm.largepages.LargePagesTest
  46  */
  47 
  48 
  49 /**
  50  * @run main/othervm/timeout=150
  51  *      -XX:+UseLargePages
  52  *      -Xmx64m
  53  *      -Xms16m
  54  *      LargePagesTest
  55  *      noThreads=5 duration=60
  56  * @summary heap shrink/grow test
  57  */
  58 final public class LargePagesTest extends Thread {
  59 
  60     private static int cnt;


 141         }
 142         if (verbose) {
 143             out.println("");
 144         }
 145 
 146 
 147         long endTime = System.currentTimeMillis();
 148         long runTime = endTime - startTime;
 149         if (duration > runTime) {
 150             out.println(getName() + "  FAILED: Execution time < requested execution time.");
 151             out.println("                execution time is " + runTime);
 152             out.println("                requested time is " + duration);
 153         } else if (iterations <= 0) {
 154             out.println(getName() + "  FAILED: No executions finished");
 155         } else {
 156             result = true;
 157         }
 158     }
 159 
 160     private void allocate() {


 161         for (int j = 0; j < 1000; j++) {

 162             int i = 0;
 163 
 164             switch (myType) {
 165             case SMALL_OBJECT_ALLOCATER:
 166                 i = 5;
 167                 break;
 168             case LARGE_OBJECT_ALLOCATER:
 169                 i = 1;
 170                 break;
 171             case ANY_OBJECT_ALLOCATER:
 172                 i = LocalRandom.nextInt(100);
 173                 break;
 174             case ANY_NO_MULTIARRAYS_ALLOCATER:
 175                 i = LocalRandom.nextInt(100);
 176                 if ((i >= 2) && (i <= 4)) {
 177                     i = 5;
 178                 }
 179                 break;
 180             default:
 181                 break;
 182             }
 183 
 184             switch (i) {
 185             case 0:
 186                 d0 = new LargePagesTest.Dummy[10];
 187                 break;
 188             case 1:
 189                 d1 = new LargePagesTest.Dummy[1000];
 190                 break;
 191             case 2:
 192                 d2 = new LargePagesTest.Dummy[10][10];
 193                 break;
 194             case 3:
 195                 d3 = new LargePagesTest.Dummy[100][100];


< prev index next >