< prev index next >

test/hotspot/jtreg/gc/z/TestHighUsage.java

Print this page

        

@@ -72,10 +72,18 @@
                 if (free > spikeAt) {
                     // Low allocation rate
                     dummy = new byte[128 * K];
                 } else {
                     // High allocation rate
+
+                    // Before inducing an allocation spike, give the GC time to
+                    // complete a cycle. This is needed in case the test system
+                    // is starved on CPU, in which case the GC might not otherwise
+                    // be able to complete a cycle before the allocation spike
+                    // happens, resulting in an allocation stall.
+                    Thread.sleep(50000);
+
                     dummy = new byte[8 * M];
                 }
 
                 Thread.sleep(250);
             }

@@ -91,11 +99,11 @@
                                                   "-XX:-ZProactive",
                                                   "-Xms128M",
                                                   "-Xmx128M",
                                                   "-XX:ParallelGCThreads=1",
                                                   "-XX:ConcGCThreads=1",
-                                                  "-Xlog:gc",
+                                                  "-Xlog:gc,gc+start",
                                                   Test.class.getName() })
                     .shouldNotContain("Allocation Stall")
                     .shouldContain("High Usage")
                     .shouldHaveExitValue(0);
     }
< prev index next >