changeset 47454:849e5737eb19

8188575: Miscellaneous changes imported from jsr166 CVS 2017-10 Reviewed-by: martin, psandoz
author dl
date Fri, 13 Oct 2017 18:34:37 -0700
parents 75ee0b48ea63
children 0a1fc9f3779c
files test/jdk/java/util/concurrent/ConcurrentQueues/GCRetention.java
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/test/jdk/java/util/concurrent/ConcurrentQueues/GCRetention.java	Fri Oct 13 18:29:21 2017 -0700
+++ b/test/jdk/java/util/concurrent/ConcurrentQueues/GCRetention.java	Fri Oct 13 18:34:37 2017 -0700
@@ -35,7 +35,7 @@
  * @bug 6785442
  * @summary Benchmark that tries to GC-tenure head, followed by
  * many add/remove operations.
- * @run main GCRetention 12345
+ * @run main GCRetention just-testing
  */
 
 import static java.util.concurrent.TimeUnit.SECONDS;
@@ -60,8 +60,8 @@
 import java.util.Map;
 
 public class GCRetention {
-    // Suitable for benchmarking.  Overridden by args[0] for testing.
-    int count = 1024 * 1024;
+    boolean benchmarkMode;
+    int count;
 
     /** No guarantees, but effective in practice. */
     static void forceFullGc() {
@@ -124,8 +124,9 @@
     }
 
     void test(String[] args) {
-        if (args.length > 0)
-            count = Integer.valueOf(args[0]);
+        benchmarkMode = ! (args.length > 0 && args[0].equals("just-testing"));
+        count = benchmarkMode ? 1024 * 1024 : 30;
+
         // Warmup
         for (Queue<Boolean> queue : queues())
             test(queue);
@@ -140,7 +141,7 @@
         long t0 = System.nanoTime();
         for (int i = 0; i < count; i++)
             check(q.add(Boolean.TRUE));
-        forceFullGc();
+        if (benchmarkMode) forceFullGc();
         // forceFullGc();
         Boolean x;
         while ((x = q.poll()) != null)