comparison test/gc/g1/TestEagerReclaimHumongousRegions2.java @ 20333:2d1534aa7131

8054362: gc/g1/TestEagerReclaimHumongousRegions2.java timeout Summary: Give the test a time limit of approximately one minute so that it exits early on slow machines. Reviewed-by: ehelin, dfazunen, brutisso
author tschatzl
date Mon, 18 Aug 2014 15:41:57 +0200
parents 83ea089a5c64
children
comparison
equal deleted inserted replaced
20332:15b01edee7c0 20333:2d1534aa7131
44 public ObjectWithSomeRefs other3; 44 public ObjectWithSomeRefs other3;
45 public ObjectWithSomeRefs other4; 45 public ObjectWithSomeRefs other4;
46 } 46 }
47 47
48 class ReclaimRegionFast { 48 class ReclaimRegionFast {
49 public static final long MAX_MILLIS_FOR_RUN = 50 * 1000; // The maximum runtime for the actual test.
50
49 public static final int M = 1024*1024; 51 public static final int M = 1024*1024;
50 52
51 public static LinkedList<Object> garbageList = new LinkedList<Object>(); 53 public static LinkedList<Object> garbageList = new LinkedList<Object>();
52 54
53 public static void genGarbage(Object large) { 55 public static void genGarbage(Object large) {
81 int[] large3 = null; 83 int[] large3 = null;
82 int[] large4 = null; 84 int[] large4 = null;
83 85
84 Object ref_from_stack = large1; 86 Object ref_from_stack = large1;
85 87
88 long start_millis = System.currentTimeMillis();
89
86 for (int i = 0; i < 20; i++) { 90 for (int i = 0; i < 20; i++) {
91 long current_millis = System.currentTimeMillis();
92 if ((current_millis - start_millis) > MAX_MILLIS_FOR_RUN) {
93 System.out.println("Finishing test because maximum runtime exceeded");
94 break;
95 }
87 // A set of large objects that will be reclaimed eagerly - and hopefully marked. 96 // A set of large objects that will be reclaimed eagerly - and hopefully marked.
88 large1 = new int[M - 20]; 97 large1 = new int[M - 20];
89 large2 = new int[M - 20]; 98 large2 = new int[M - 20];
90 large3 = new int[M - 20]; 99 large3 = new int[M - 20];
91 large4 = new int[M - 20]; 100 large4 = new int[M - 20];