changeset 159:511a26839ce9

Cleanup MicrobenchmarkParameters -> BenchmarkParams.
author shade
date Thu, 29 Aug 2013 16:59:21 +0400
parents ee135e6ab5c0
children f75b8c3a1ded
files jmh-core/src/main/java/org/openjdk/jmh/output/format/CsvFormat.java jmh-core/src/main/java/org/openjdk/jmh/output/format/OutputFormat.java jmh-core/src/main/java/org/openjdk/jmh/output/format/PrettyPrintFormat.java jmh-core/src/main/java/org/openjdk/jmh/output/format/SilentFormat.java jmh-core/src/main/java/org/openjdk/jmh/output/format/TextReportFormat.java jmh-core/src/main/java/org/openjdk/jmh/runner/BaseMicroBenchmarkHandler.java jmh-core/src/main/java/org/openjdk/jmh/runner/BaseRunner.java jmh-core/src/main/java/org/openjdk/jmh/runner/LoopMicroBenchmarkHandler.java jmh-core/src/main/java/org/openjdk/jmh/runner/MicroBenchmarkHandlers.java jmh-core/src/main/java/org/openjdk/jmh/runner/parameters/BenchmarkParams.java jmh-core/src/main/java/org/openjdk/jmh/runner/parameters/MicroBenchmarkParameters.java jmh-core/src/main/java/org/openjdk/jmh/runner/parameters/MicroBenchmarkParametersFactory.java
diffstat 12 files changed, 169 insertions(+), 238 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/output/format/CsvFormat.java	Thu Aug 29 16:49:13 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/output/format/CsvFormat.java	Thu Aug 29 16:59:21 2013 +0400
@@ -29,7 +29,7 @@
 import org.openjdk.jmh.logic.results.internal.RunResult;
 import org.openjdk.jmh.profile.ProfilerResult;
 import org.openjdk.jmh.runner.BenchmarkRecord;
-import org.openjdk.jmh.runner.parameters.MicroBenchmarkParameters;
+import org.openjdk.jmh.runner.parameters.BenchmarkParams;
 import org.openjdk.jmh.runner.parameters.TimeValue;
 
 import java.io.PrintStream;
@@ -67,7 +67,7 @@
     }
 
     @Override
-    public void startBenchmark(BenchmarkRecord name, MicroBenchmarkParameters mbParams, boolean verbose) {
+    public void startBenchmark(BenchmarkRecord name, BenchmarkParams mbParams, boolean verbose) {
         if (!headerPrinted) {
             headerPrinted = true;
 
--- a/jmh-core/src/main/java/org/openjdk/jmh/output/format/OutputFormat.java	Thu Aug 29 16:49:13 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/output/format/OutputFormat.java	Thu Aug 29 16:59:21 2013 +0400
@@ -28,7 +28,7 @@
 import org.openjdk.jmh.logic.results.internal.RunResult;
 import org.openjdk.jmh.profile.ProfilerResult;
 import org.openjdk.jmh.runner.BenchmarkRecord;
-import org.openjdk.jmh.runner.parameters.MicroBenchmarkParameters;
+import org.openjdk.jmh.runner.parameters.BenchmarkParams;
 import org.openjdk.jmh.runner.parameters.TimeValue;
 
 import java.io.IOException;
@@ -70,7 +70,7 @@
      *
      * @param verbose Should we output verbose info?
      */
-    public void startBenchmark(BenchmarkRecord name, MicroBenchmarkParameters mbParams, boolean verbose);
+    public void startBenchmark(BenchmarkRecord name, BenchmarkParams mbParams, boolean verbose);
 
     /**
      * Format for end-of-benchmark.
--- a/jmh-core/src/main/java/org/openjdk/jmh/output/format/PrettyPrintFormat.java	Thu Aug 29 16:49:13 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/output/format/PrettyPrintFormat.java	Thu Aug 29 16:59:21 2013 +0400
@@ -29,7 +29,7 @@
 import org.openjdk.jmh.logic.results.internal.RunResult;
 import org.openjdk.jmh.profile.ProfilerResult;
 import org.openjdk.jmh.runner.BenchmarkRecord;
-import org.openjdk.jmh.runner.parameters.MicroBenchmarkParameters;
+import org.openjdk.jmh.runner.parameters.BenchmarkParams;
 import org.openjdk.jmh.runner.parameters.TimeValue;
 import org.openjdk.jmh.util.internal.Multimap;
 import org.openjdk.jmh.util.internal.TreeMultimap;
@@ -80,7 +80,7 @@
 
 
     @Override
-    public void startBenchmark(BenchmarkRecord name, MicroBenchmarkParameters mbParams, boolean verbose) {
+    public void startBenchmark(BenchmarkRecord name, BenchmarkParams mbParams, boolean verbose) {
         if (verbose) {
             out.println("# Starting run at: " + new Date());
         }
--- a/jmh-core/src/main/java/org/openjdk/jmh/output/format/SilentFormat.java	Thu Aug 29 16:49:13 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/output/format/SilentFormat.java	Thu Aug 29 16:59:21 2013 +0400
@@ -28,7 +28,7 @@
 import org.openjdk.jmh.logic.results.internal.RunResult;
 import org.openjdk.jmh.profile.ProfilerResult;
 import org.openjdk.jmh.runner.BenchmarkRecord;
-import org.openjdk.jmh.runner.parameters.MicroBenchmarkParameters;
+import org.openjdk.jmh.runner.parameters.BenchmarkParams;
 import org.openjdk.jmh.runner.parameters.TimeValue;
 
 import java.io.PrintStream;
@@ -54,7 +54,7 @@
     }
 
     @Override
-    public void startBenchmark(BenchmarkRecord name, MicroBenchmarkParameters mbParams, boolean verbose) {
+    public void startBenchmark(BenchmarkRecord name, BenchmarkParams mbParams, boolean verbose) {
 
     }
 
--- a/jmh-core/src/main/java/org/openjdk/jmh/output/format/TextReportFormat.java	Thu Aug 29 16:49:13 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/output/format/TextReportFormat.java	Thu Aug 29 16:59:21 2013 +0400
@@ -29,8 +29,8 @@
 import org.openjdk.jmh.logic.results.internal.RunResult;
 import org.openjdk.jmh.profile.ProfilerResult;
 import org.openjdk.jmh.runner.BenchmarkRecord;
+import org.openjdk.jmh.runner.parameters.BenchmarkParams;
 import org.openjdk.jmh.runner.parameters.IterationParams;
-import org.openjdk.jmh.runner.parameters.MicroBenchmarkParameters;
 import org.openjdk.jmh.util.ClassUtils;
 import org.openjdk.jmh.util.internal.Multimap;
 import org.openjdk.jmh.util.internal.Statistics;
@@ -62,7 +62,7 @@
     }
 
     @Override
-    public void startBenchmark(BenchmarkRecord name, MicroBenchmarkParameters mbParams, boolean verbose) {
+    public void startBenchmark(BenchmarkRecord name, BenchmarkParams mbParams, boolean verbose) {
         super.startBenchmark(name, mbParams, verbose);
         benchmarkSettings.put(name, mbParams.getIteration());
     }
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/BaseMicroBenchmarkHandler.java	Thu Aug 29 16:49:13 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/BaseMicroBenchmarkHandler.java	Thu Aug 29 16:59:21 2013 +0400
@@ -29,7 +29,7 @@
 import org.openjdk.jmh.profile.Profiler;
 import org.openjdk.jmh.profile.ProfilerType;
 import org.openjdk.jmh.runner.options.Options;
-import org.openjdk.jmh.runner.parameters.MicroBenchmarkParameters;
+import org.openjdk.jmh.runner.parameters.BenchmarkParams;
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
@@ -64,7 +64,7 @@
 
     private final List<Profiler> registeredProfilers;
 
-    public BaseMicroBenchmarkHandler(OutputFormat format, BenchmarkRecord microbenchmark, final Class<?> clazz, Options options, MicroBenchmarkParameters executionParams) {
+    public BaseMicroBenchmarkHandler(OutputFormat format, BenchmarkRecord microbenchmark, final Class<?> clazz, Options options, BenchmarkParams executionParams) {
         this.microbenchmark = microbenchmark;
         this.registeredProfilers = createProfilers(options);
         this.executor = EXECUTOR_TYPE.createExecutor(executionParams.getThreads(), microbenchmark.getUsername());
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/BaseRunner.java	Thu Aug 29 16:49:13 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/BaseRunner.java	Thu Aug 29 16:59:21 2013 +0400
@@ -31,9 +31,8 @@
 import org.openjdk.jmh.output.format.IterationType;
 import org.openjdk.jmh.output.format.OutputFormat;
 import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.parameters.BenchmarkParams;
 import org.openjdk.jmh.runner.parameters.IterationParams;
-import org.openjdk.jmh.runner.parameters.MicroBenchmarkParameters;
-import org.openjdk.jmh.runner.parameters.MicroBenchmarkParametersFactory;
 import org.openjdk.jmh.util.ClassUtils;
 
 import java.lang.management.GarbageCollectorMXBean;
@@ -67,7 +66,7 @@
             Class<?> clazz = ClassUtils.loadClass(benchmark.generatedClass());
             Method method = MicroBenchmarkHandlers.findBenchmarkMethod(clazz, benchmark.generatedMethod());
 
-            MicroBenchmarkParameters executionParams = MicroBenchmarkParametersFactory.makeParams(options, benchmark, method, doWarmup, doMeasurement);
+            BenchmarkParams executionParams = BenchmarkParams.makeParams(options, benchmark, method, doWarmup, doMeasurement);
             handler = MicroBenchmarkHandlers.getInstance(out, benchmark, clazz, method, executionParams, options);
 
             return runBenchmark(executionParams, handler);
@@ -85,7 +84,7 @@
         return null;
     }
 
-    protected RunResult runBenchmark(MicroBenchmarkParameters executionParams, MicroBenchmarkHandler handler) {
+    protected RunResult runBenchmark(BenchmarkParams executionParams, MicroBenchmarkHandler handler) {
         List<IterationData> allResults = new ArrayList<IterationData>();
 
         out.startBenchmark(handler.getBenchmark(), executionParams, this.options.isVerbose());
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/LoopMicroBenchmarkHandler.java	Thu Aug 29 16:49:13 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/LoopMicroBenchmarkHandler.java	Thu Aug 29 16:59:21 2013 +0400
@@ -31,8 +31,8 @@
 import org.openjdk.jmh.logic.results.Result;
 import org.openjdk.jmh.output.format.OutputFormat;
 import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.parameters.BenchmarkParams;
 import org.openjdk.jmh.runner.parameters.IterationParams;
-import org.openjdk.jmh.runner.parameters.MicroBenchmarkParameters;
 import org.openjdk.jmh.runner.parameters.TimeValue;
 
 import java.lang.reflect.InvocationTargetException;
@@ -61,7 +61,7 @@
     private final boolean shouldSynchIterations;
     private final boolean shouldFailOnError;
 
-    LoopMicroBenchmarkHandler(OutputFormat format, BenchmarkRecord microbenchmark, Class<?> clazz, Method method, Options options, MicroBenchmarkParameters executionParams) {
+    LoopMicroBenchmarkHandler(OutputFormat format, BenchmarkRecord microbenchmark, Class<?> clazz, Method method, Options options, BenchmarkParams executionParams) {
         super(format, microbenchmark, clazz, options, executionParams);
         this.method = method;
         this.shouldSynchIterations = (microbenchmark.getMode() != Mode.SingleShotTime) && executionParams.shouldSynchIterations();
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/MicroBenchmarkHandlers.java	Thu Aug 29 16:49:13 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/MicroBenchmarkHandlers.java	Thu Aug 29 16:59:21 2013 +0400
@@ -28,7 +28,7 @@
 import org.openjdk.jmh.logic.results.Result;
 import org.openjdk.jmh.output.format.OutputFormat;
 import org.openjdk.jmh.runner.options.Options;
-import org.openjdk.jmh.runner.parameters.MicroBenchmarkParameters;
+import org.openjdk.jmh.runner.parameters.BenchmarkParams;
 import org.openjdk.jmh.util.ClassUtils;
 
 import java.lang.reflect.Method;
@@ -67,7 +67,7 @@
         return method;
     }
 
-    public static MicroBenchmarkHandler getInstance(OutputFormat out, BenchmarkRecord microbenchmark, Class<?> clazz, Method method, MicroBenchmarkParameters executionParams, Options options) {
+    public static MicroBenchmarkHandler getInstance(OutputFormat out, BenchmarkRecord microbenchmark, Class<?> clazz, Method method, BenchmarkParams executionParams, Options options) {
         return new LoopMicroBenchmarkHandler(out, microbenchmark, clazz, method, options, executionParams);
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/parameters/BenchmarkParams.java	Thu Aug 29 16:59:21 2013 +0400
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.openjdk.jmh.runner.parameters;
+
+
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.Threads;
+import org.openjdk.jmh.annotations.Warmup;
+import org.openjdk.jmh.runner.BenchmarkRecord;
+import org.openjdk.jmh.runner.options.Options;
+
+import java.io.Serializable;
+import java.lang.reflect.Method;
+
+public class BenchmarkParams implements Serializable {
+
+    public static BenchmarkParams makeParams(Options options, BenchmarkRecord benchmark, Method method, boolean doWarmup, boolean doMeasurement) {
+        boolean shouldSynchIterations = getBoolean(options.getSynchIterations(), Defaults.SHOULD_SYNCH_ITERATIONS);
+
+        int threads = getThreads(options, method);
+        if (threads == 0) {
+            threads = Runtime.getRuntime().availableProcessors();
+        }
+
+        IterationParams measurement = doMeasurement ?
+                getMeasurement(options, benchmark, method, threads) :
+                new IterationParams(0, TimeValue.NONE, 1);
+
+        IterationParams warmup = doWarmup ?
+                getWarmup(options, benchmark, method, threads) :
+                new IterationParams(0, TimeValue.NONE, 1);
+
+        return new BenchmarkParams(
+                shouldSynchIterations,
+                warmup, measurement,
+                threads);
+    }
+
+    private static IterationParams getWarmup(Options options, BenchmarkRecord benchmark, Method method, int threads) {
+        boolean isSingleShot = (benchmark.getMode() == Mode.SingleShotTime);
+        Warmup warAnn = method.getAnnotation(Warmup.class);
+        int iters = (warAnn == null) ? -1 : warAnn.iterations();
+        if (isSingleShot) {
+            return new IterationParams(
+                    getInteger(options.getWarmupIterations(), iters, Defaults.SINGLE_SHOT_WARMUP_COUNT),
+                    TimeValue.NONE,
+                    threads);
+        } else {
+            TimeValue timeValue = options.getWarmupTime();
+            if (timeValue == null || timeValue.getTime() == -1) {
+                if (warAnn != null) {
+                    timeValue = new TimeValue(warAnn.time(), warAnn.timeUnit());
+                } else {
+                    timeValue = Defaults.WARMUP_TIME;
+                }
+            }
+            return new IterationParams(getInteger(options.getWarmupIterations(), iters, Defaults.WARMUP_COUNT), timeValue, threads);
+        }
+    }
+
+    private static IterationParams getMeasurement(Options options, BenchmarkRecord benchmark, Method method, int threads) {
+        boolean isSingleShot = (benchmark.getMode() == Mode.SingleShotTime);
+        Measurement meAnn = method.getAnnotation(Measurement.class);
+        int iters = (meAnn == null) ? -1 : meAnn.iterations();
+        if (isSingleShot) {
+            return new IterationParams(
+                    getInteger(options.getIterations(), iters, Defaults.SINGLE_SHOT_ITERATION_COUNT),
+                    TimeValue.NONE,
+                    threads);
+
+        } else {
+            TimeValue timeValue = options.getRuntime();
+            if (timeValue == null || timeValue.getTime() == -1) {
+                if (meAnn != null) {
+                    timeValue = new TimeValue(meAnn.time(), meAnn.timeUnit());
+                } else {
+                    timeValue = Defaults.ITERATION_TIME;
+                }
+            }
+            return new IterationParams(
+                    getInteger(options.getIterations(), iters, Defaults.ITERATION_COUNT), timeValue, threads);
+        }
+    }
+
+    private static int getThreads(Options options, Method method) {
+        Threads threadsAnn = method.getAnnotation(Threads.class);
+        return getInteger(options.getThreads(), (threadsAnn == null) ? -1 : threadsAnn.value(), Defaults.THREADS);
+
+    }
+
+    private final boolean synchIterations;
+    private final int threads;
+    private final IterationParams warmup;
+    private final IterationParams iteration;
+
+    public BenchmarkParams(boolean synchIterations, IterationParams warmup, IterationParams iteration, int threads) {
+        this.synchIterations = synchIterations;
+        this.warmup = warmup;
+        this.iteration = iteration;
+        this.threads = threads;
+    }
+
+    public boolean shouldSynchIterations() {
+        return synchIterations;
+    }
+
+    public IterationParams getWarmup() {
+        return warmup;
+    }
+
+    public IterationParams getIteration() {
+        return iteration;
+    }
+
+    public int getThreads() {
+        return threads;
+    }
+
+    private static boolean getBoolean(Boolean value, boolean defaultValue) {
+        return value == null ? defaultValue : value;
+    }
+
+    private static int getInteger(int first, int second, int third) {
+        return first >= 0 ? first : (second >= 0 ? second : third);
+    }
+
+}
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/parameters/MicroBenchmarkParameters.java	Thu Aug 29 16:49:13 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package org.openjdk.jmh.runner.parameters;
-
-
-import java.util.List;
-
-/**
- * @author sergey.kuksenko@oracle.com
- */
-public interface MicroBenchmarkParameters {
-
-    /**
-     * Will the harness continue to execute work in all threads until all thread have returned a Result from their
-     * measured part of the run?
-     *
-     * @return true if they will
-     */
-    public boolean shouldSynchIterations();
-
-    public IterationParams getWarmup();
-
-    public IterationParams getIteration();
-
-    public int getThreads();
-
-}
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/parameters/MicroBenchmarkParametersFactory.java	Thu Aug 29 16:49:13 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,169 +0,0 @@
-/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package org.openjdk.jmh.runner.parameters;
-
-import org.openjdk.jmh.annotations.Measurement;
-import org.openjdk.jmh.annotations.Mode;
-import org.openjdk.jmh.annotations.Threads;
-import org.openjdk.jmh.annotations.Warmup;
-import org.openjdk.jmh.runner.BenchmarkRecord;
-import org.openjdk.jmh.runner.options.Options;
-
-import java.io.Serializable;
-import java.lang.reflect.Method;
-
-public class MicroBenchmarkParametersFactory {
-
-    private MicroBenchmarkParametersFactory() {
-    }
-
-    public static MicroBenchmarkParameters makeParams(Options options, BenchmarkRecord benchmark, Method method, boolean doWarmup, boolean doMeasurement) {
-        boolean shouldSynchIterations = getBoolean(options.getSynchIterations(), Defaults.SHOULD_SYNCH_ITERATIONS);
-
-        int threads = getThreads(options, method);
-        if (threads == 0) {
-            threads = Runtime.getRuntime().availableProcessors();
-        }
-
-        IterationParams measurement = doMeasurement ?
-                getMeasurement(options, benchmark, method, threads) :
-                new IterationParams(0, TimeValue.NONE, 1);
-
-        IterationParams warmup = doWarmup ?
-                getWarmup(options, benchmark, method, threads) :
-                new IterationParams(0, TimeValue.NONE, 1);
-
-        return new SameThreadParameters(
-                shouldSynchIterations,
-                warmup, measurement,
-                threads);
-    }
-
-    private static IterationParams getWarmup(Options options, BenchmarkRecord benchmark, Method method, int threads) {
-        boolean isSingleShot = (benchmark.getMode() == Mode.SingleShotTime);
-        Warmup warAnn = method.getAnnotation(Warmup.class);
-        int iters = (warAnn == null) ? -1 : warAnn.iterations();
-        if (isSingleShot) {
-            return new IterationParams(
-                    getInteger(options.getWarmupIterations(), iters, Defaults.SINGLE_SHOT_WARMUP_COUNT),
-                    TimeValue.NONE,
-                    threads);
-        } else {
-            TimeValue timeValue = options.getWarmupTime();
-            if (timeValue == null || timeValue.getTime() == -1) {
-                if (warAnn != null) {
-                    timeValue = new TimeValue(warAnn.time(), warAnn.timeUnit());
-                } else {
-                    timeValue = Defaults.WARMUP_TIME;
-                }
-            }
-            return new IterationParams(getInteger(options.getWarmupIterations(), iters, Defaults.WARMUP_COUNT),timeValue, threads);
-        }
-    }
-
-    private static IterationParams getMeasurement(Options options, BenchmarkRecord benchmark, Method method, int threads) {
-        boolean isSingleShot = (benchmark.getMode() == Mode.SingleShotTime);
-        Measurement meAnn = method.getAnnotation(Measurement.class);
-        int iters = (meAnn == null) ? -1 : meAnn.iterations();
-        if (isSingleShot) {
-            return new IterationParams(
-                    getInteger(options.getIterations(), iters, Defaults.SINGLE_SHOT_ITERATION_COUNT),
-                    TimeValue.NONE,
-                    threads);
-
-        } else {
-            TimeValue timeValue = options.getRuntime();
-            if (timeValue == null || timeValue.getTime() == -1) {
-                if (meAnn != null) {
-                    timeValue = new TimeValue(meAnn.time(), meAnn.timeUnit());
-                } else {
-                    timeValue = Defaults.ITERATION_TIME;
-                }
-            }
-            return new IterationParams(
-                    getInteger(options.getIterations(), iters, Defaults.ITERATION_COUNT), timeValue, threads);
-        }
-    }
-
-    private static int getThreads(Options options, Method method) {
-        Threads threadsAnn = method.getAnnotation(Threads.class);
-        return getInteger(options.getThreads(), (threadsAnn == null) ? -1 : threadsAnn.value(), Defaults.THREADS);
-
-    }
-
-    static abstract class AbstractParameters implements MicroBenchmarkParameters, Serializable {
-
-        private final boolean synchIterations;
-
-        private final IterationParams warmup;
-        private final IterationParams iteration;
-
-        public AbstractParameters(boolean synchIterations, IterationParams warmup, IterationParams iteration) {
-            this.synchIterations = synchIterations;
-            this.warmup = warmup;
-            this.iteration = iteration;
-        }
-
-        @Override
-        public boolean shouldSynchIterations() {
-            return synchIterations;
-        }
-
-        @Override
-        public IterationParams getWarmup() {
-            return warmup;
-        }
-
-        @Override
-        public IterationParams getIteration() {
-            return iteration;
-        }
-    }
-
-    static class SameThreadParameters extends AbstractParameters {
-
-        private final int threads;
-
-        public SameThreadParameters(boolean synchIterations, IterationParams warmup, IterationParams iteration, int threads) {
-            super(synchIterations, warmup, iteration);
-            this.threads = threads;
-        }
-
-        @Override
-        public int getThreads() {
-            return threads;
-        }
-
-    }
-
-    private static boolean getBoolean(Boolean value, boolean defaultValue) {
-        return value==null ? defaultValue : value;
-    }
-
-    private static int getInteger(int first, int second, int third) {
-        return first >= 0 ? first : (second >= 0 ? second : third);
-    }
-
-}