# HG changeset patch # User shade # Date 1481839079 -3600 # Node ID 7c8ea59bcd6a712c1d19d63b2e349da17aac7bdf # Parent 79ac5fe68ddd141433a7ca3c655acae5b0a69981 Tunable thread numbers, make at least one oversubscribed datapoint. diff -r 79ac5fe68ddd -r 7c8ea59bcd6a src/main/java/org/openjdk/gcbench/GCBench.java --- 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 optMinHeap = parser.accepts("minHeap", "Min heap to be used for tests.") .withRequiredArg().ofType(Integer.class).describedAs("MB").defaultsTo(8192); + OptionSpec optMinThreads = parser.accepts("minThreads", "Min threads to be used for tests.") + .withRequiredArg().ofType(Integer.class).describedAs("#").defaultsTo(1); + + OptionSpec 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)) )); diff -r 79ac5fe68ddd -r 7c8ea59bcd6a src/main/java/org/openjdk/gcbench/tests/Dimensions.java --- 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() {