changeset 52:7c8ea59bcd6a

Tunable thread numbers, make at least one oversubscribed datapoint.
author shade
date Thu, 15 Dec 2016 22:57:59 +0100
parents 79ac5fe68ddd
children fca0611bff52
files src/main/java/org/openjdk/gcbench/GCBench.java src/main/java/org/openjdk/gcbench/tests/Dimensions.java
diffstat 2 files changed, 20 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/org/openjdk/gcbench/GCBench.java	Thu Dec 15 22:54:46 2016 +0100
+++ b/src/main/java/org/openjdk/gcbench/GCBench.java	Thu Dec 15 22:57:59 2016 +0100
@@ -75,6 +75,12 @@
         OptionSpec<Integer> optMinHeap = parser.accepts("minHeap", "Min heap to be used for tests.")
                 .withRequiredArg().ofType(Integer.class).describedAs("MB").defaultsTo(8192);
 
+        OptionSpec<Integer> optMinThreads = parser.accepts("minThreads", "Min threads to be used for tests.")
+                .withRequiredArg().ofType(Integer.class).describedAs("#").defaultsTo(1);
+
+        OptionSpec<Integer> optMaxThreads = parser.accepts("maxThreads", "Max threads to be used for tests. Leave unset to enable auto-detection.")
+                .withRequiredArg().ofType(Integer.class).describedAs("#");
+
         parser.accepts("h", "Print help.");
 
         OptionSet set = parser.parse(args);
@@ -91,6 +97,14 @@
             HeapSizeManager.init(set.valueOf(optMinHeap), pw);
         }
 
+        final int MIN_THREADS = set.valueOf(optMinThreads);
+        final int MAX_THREADS;
+        if (set.has(optMaxThreads)) {
+            MAX_THREADS = optMaxThreads.value(set);
+        } else {
+            MAX_THREADS = Runtime.getRuntime().availableProcessors()*2;
+        }
+
         Options opts = new OptionsBuilder()
                 .detectJvmArgs()
                 .threads(Threads.MAX)
@@ -157,20 +171,20 @@
 
             tests.add(new DimensionalTest(baseOpts, org.openjdk.gcbench.alloc.plain.Objects.class,
                     "alloc.peak.object", groupDescr + "Allocates plain Java Objects.",
-                    Dimensions.threads(),
+                    Dimensions.threads(Sequence.powersOfTwo(MIN_THREADS, MAX_THREADS)),
                     Dimensions.heapSize(Sequence.powersOfTwo_WithMax(HeapSizeManager.MIN_HEAP, HeapSizeManager.MAX_HEAP))
             ));
 
             tests.add(new DimensionalTest(baseOpts, org.openjdk.gcbench.alloc.plain.PrimArray.class,
                     "alloc.peak.intarray", groupDescr + "Allocates int[] arrays of different sizes.",
-                    Dimensions.threads(),
+                    Dimensions.threads(Sequence.powersOfTwo(MIN_THREADS, MAX_THREADS)),
                     Dimensions.heapSize(Sequence.powersOfTwo_WithMax(HeapSizeManager.MIN_HEAP, HeapSizeManager.MAX_HEAP)),
                     Dimensions.size(Sequence.powersOfTen(1, 10_000_000))
             ));
 
             tests.add(new DimensionalTest(baseOpts, org.openjdk.gcbench.alloc.plain.RefArray.class,
                     "alloc.peak.refarray", groupDescr + "Allocates Object[] arrays of different sizes.",
-                    Dimensions.threads(),
+                    Dimensions.threads(Sequence.powersOfTwo(MIN_THREADS, MAX_THREADS)),
                     Dimensions.heapSize(Sequence.powersOfTwo_WithMax(HeapSizeManager.MIN_HEAP, HeapSizeManager.MAX_HEAP)),
                     Dimensions.size(Sequence.powersOfTen(1, 10_000_000))
             ));
@@ -183,7 +197,7 @@
 
             tests.add(new DimensionalTest(baseOpts, org.openjdk.gcbench.alloc.uninit.IntArray.class,
                     "alloc.uninit.intarray", groupDescr + "Allocates uninitialized int[] arrays of different sizes.",
-                    Dimensions.threads(),
+                    Dimensions.threads(Sequence.powersOfTwo(MIN_THREADS, MAX_THREADS)),
                     Dimensions.heapSize(Sequence.powersOfTwo_WithMax(HeapSizeManager.MIN_HEAP, HeapSizeManager.MAX_HEAP)),
                     Dimensions.size(Sequence.powersOfTen(1, 10_000))
             ));
--- a/src/main/java/org/openjdk/gcbench/tests/Dimensions.java	Thu Dec 15 22:54:46 2016 +0100
+++ b/src/main/java/org/openjdk/gcbench/tests/Dimensions.java	Thu Dec 15 22:57:59 2016 +0100
@@ -23,8 +23,8 @@
         return new Dimension(DimensionType.SIZE, seq);
     }
 
-    public static Dimension threads() {
-        return new Dimension(DimensionType.THREADS, Sequence.powersOfTwo(1, Runtime.getRuntime().availableProcessors()));
+    public static Dimension threads(Sequence seq) {
+        return new Dimension(DimensionType.THREADS, seq);
     }
 
     public static Dimension jvmMode() {