changeset 152:9b7bbf28d685

Touchups to the API.
author shade
date Tue, 27 Aug 2013 18:53:26 +0400
parents 81c3deb0f69f
children 2621152f8474
files jmh-api-samples/src/main/java/org/openjdk/jmh/SimpleTest.java jmh-core/src/main/java/org/openjdk/jmh/runner/options/ChainedOptionsBuilder.java jmh-core/src/main/java/org/openjdk/jmh/runner/options/DefaultBuilder.java jmh-core/src/main/java/org/openjdk/jmh/runner/options/OptionsBuilder.java jmh-core/src/main/java/org/openjdk/jmh/runner/parameters/TimeValue.java
diffstat 5 files changed, 611 insertions(+), 451 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-api-samples/src/main/java/org/openjdk/jmh/SimpleTest.java	Tue Aug 27 17:59:27 2013 +0400
+++ b/jmh-api-samples/src/main/java/org/openjdk/jmh/SimpleTest.java	Tue Aug 27 18:53:26 2013 +0400
@@ -26,13 +26,14 @@
 
 import org.openjdk.jmh.runner.Runner;
 import org.openjdk.jmh.runner.RunnerException;
-import org.openjdk.jmh.runner.options.DefaultBuilder;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
 import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.parameters.TimeValue;
 
 public class SimpleTest {
 
     public static void main(String[] args) throws RunnerException {
-        Options opts = DefaultBuilder.start().addBenchmark(".*").shouldBeVerbose(true).jvmArgs("-server").end();
+        Options opts = new OptionsBuilder().include(".*").warmupTime(TimeValue.seconds(1)).jvmArgs("-server").build();
         new Runner(opts).run();
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/options/ChainedOptionsBuilder.java	Tue Aug 27 18:53:26 2013 +0400
@@ -0,0 +1,219 @@
+/*
+ * 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.options;
+
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.output.OutputFormatType;
+import org.openjdk.jmh.profile.ProfilerType;
+import org.openjdk.jmh.runner.parameters.TimeValue;
+
+import java.util.concurrent.TimeUnit;
+
+public interface ChainedOptionsBuilder {
+
+    /**
+     * Produce the final Options
+     * @return options object.
+     */
+    Options build();
+
+    /**
+     * Include benchmark in the run
+     * (Can be used multiple times)
+     *
+     * @param regexp to match benchmarks against
+     * @return builder
+     */
+    ChainedOptionsBuilder include(String regexp);
+
+    /**
+     * Exclude benchmarks from the run
+     * (Can be used multiple times)
+     *
+     * @param regexp to match benchmark against
+     * @return builder
+     */
+    ChainedOptionsBuilder exclude(String regexp);
+
+    /**
+     * OutputFormat to use in the run
+     * @param type outputformat type
+     * @return builder
+     */
+    ChainedOptionsBuilder outputFormat(OutputFormatType type);
+
+    /**
+     * Output filename to write the run log to
+     * @param filename file name
+     * @return builder
+     */
+    ChainedOptionsBuilder output(String filename);
+
+    /**
+     * Should do GC between measurementIterations?
+     * @param value flag
+     * @return builder
+     */
+    ChainedOptionsBuilder shouldDoGC(boolean value);
+
+    /**
+     * Add the profiler in the run
+     * @param prof profiler type
+     * @return builder
+     */
+    ChainedOptionsBuilder addProfiler(ProfilerType prof);
+
+    /**
+     * Be extra verbose?
+     * @param value flag
+     * @return builder
+     */
+    ChainedOptionsBuilder verbose(boolean value);
+
+    /**
+     * Should fail on first benchmark error?
+     * @param value flag
+     * @return builder
+     */
+    ChainedOptionsBuilder failOnError(boolean value);
+
+    /**
+     * Output extra details?
+     * @param value flag
+     * @return builder
+     */
+    ChainedOptionsBuilder outputDetails(boolean value);
+
+    /**
+     * Number of threads to run the benchmark in
+     * @param count number of threads
+     * @return builder
+     */
+    ChainedOptionsBuilder threads(int count);
+
+    /**
+     * Should synchronize measurementIterations?
+     * @param value flag
+     * @return builder
+     */
+    ChainedOptionsBuilder syncIterations(boolean value);
+
+    /**
+     * How many warmup measurementIterations to do?
+     * @param value flag
+     * @return builder
+     */
+    ChainedOptionsBuilder warmupIterations(int value);
+
+    /**
+     * How long each warmup iteration should take?
+     * @param value time
+     * @return builder
+     */
+    ChainedOptionsBuilder warmupTime(TimeValue value);
+
+    /**
+     * Warmup mode to use
+     * @param mode to use
+     * @return builder
+     */
+    ChainedOptionsBuilder warmupMode(WarmupMode mode);
+
+    /**
+     * What other benchmarks to warmup along the way
+     * @param regexp to match benchmarks against
+     * @return builder
+     */
+    ChainedOptionsBuilder includeWarmup(String regexp);
+
+    /**
+     * How many measurement measurementIterations to do
+     * @param count number of iterations
+     * @return builder
+     */
+    ChainedOptionsBuilder measurementIterations(int count);
+
+    /**
+     * How long each measurement iteration should take?
+     * @param value time
+     * @return builder
+     */
+    ChainedOptionsBuilder measurementTime(TimeValue value);
+
+    /**
+     * Benchmark mode.
+     * (Can be used multiple times)
+     *
+     * @param mode benchmark mode
+     * @return builder
+     */
+    ChainedOptionsBuilder mode(Mode mode);
+
+    /**
+     * Timeunit to use in results
+     * @param tu time unit
+     * @return builder
+     */
+    ChainedOptionsBuilder timeUnit(TimeUnit tu);
+
+    /**
+     * Number of forks to use in the run
+     * @param value number of forks
+     * @return builder
+     */
+    ChainedOptionsBuilder forks(int value);
+
+    /**
+     * Number of ignored forks
+     * @param value number of ignored forks
+     * @return builder
+     */
+    ChainedOptionsBuilder warmupForks(int value);
+
+    /**
+     * Forked JVM to use.
+     *
+     * @param path path to /bin/java
+     * @return builder
+     */
+    ChainedOptionsBuilder jvm(String path);
+
+    /**
+     * Forked JVM classpath.
+     *
+     * @param value classpath to override with
+     * @return builder
+     */
+    ChainedOptionsBuilder jvmClasspath(String value);
+
+    /**
+     * Forked JVM arguments.
+     *
+     * @param value arguments to override with
+     * @return builder
+     */
+    ChainedOptionsBuilder jvmArgs(String value);
+
+}
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/options/DefaultBuilder.java	Tue Aug 27 17:59:27 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,423 +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.options;
-
-import org.openjdk.jmh.annotations.Mode;
-import org.openjdk.jmh.output.OutputFormatType;
-import org.openjdk.jmh.profile.ProfilerType;
-import org.openjdk.jmh.runner.parameters.TimeValue;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.EnumSet;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-public class DefaultBuilder implements Options, OptionsBuilder {
-
-    public static OptionsBuilder start() {
-        return new DefaultBuilder();
-    }
-
-    private boolean finalized;
-
-    private void checkFinalized() {
-        if (finalized) {
-            throw new IllegalStateException("The builder is already finalized");
-        }
-    }
-
-    @Override
-    public Options end() {
-        finalized = true;
-        return this;
-    }
-
-    // ---------------------------------------------------------------------------
-
-    private final List<String> regexps = new ArrayList<String>();
-
-    @Override
-    public OptionsBuilder addBenchmark(String regexp) {
-        checkFinalized();
-        regexps.add(regexp);
-        return this;
-    }
-
-    @Override
-    public List<String> getRegexps() {
-        return regexps;
-    }
-
-    // ---------------------------------------------------------------------------
-
-    private final List<String> excludes = new ArrayList<String>();
-
-    @Override
-    public OptionsBuilder addExclude(String regexp) {
-        excludes.add(regexp);
-        return this;
-    }
-
-    @Override
-    public List<String> getExcludes() {
-        return excludes;
-    }
-
-    // ---------------------------------------------------------------------------
-
-    private OutputFormatType ofType = OutputFormatType.defaultType();
-
-    @Override
-    public OptionsBuilder outputFormat(OutputFormatType type) {
-        ofType = type;
-        return this;
-    }
-
-    @Override
-    public OutputFormatType getOutputFormat() {
-        return ofType;
-    }
-
-    // ---------------------------------------------------------------------------
-
-    private String output;
-
-    @Override
-    public OptionsBuilder setOutput(String filename) {
-        this.output = filename;
-        return this;
-    }
-
-    @Override
-    public String getOutput() {
-        return output;
-    }
-
-    // ---------------------------------------------------------------------------
-
-    private boolean shouldDoGC;
-
-    @Override
-    public OptionsBuilder shouldDoGC(boolean value) {
-        shouldDoGC = value;
-        return this;
-    }
-
-    @Override
-    public boolean shouldDoGC() {
-        return shouldDoGC;
-    }
-
-    // ---------------------------------------------------------------------------
-
-    private EnumSet<ProfilerType> profilers = EnumSet.noneOf(ProfilerType.class);
-
-    @Override
-    public OptionsBuilder addProfiler(ProfilerType prof) {
-        this.profilers.add(prof);
-        return this;
-    }
-
-    @Override
-    public Set<ProfilerType> getProfilers() {
-        return profilers;
-    }
-
-    // ---------------------------------------------------------------------------
-
-    private boolean isVerbose;
-
-    @Override
-    public OptionsBuilder shouldBeVerbose(boolean value) {
-        isVerbose = value;
-        return this;
-    }
-
-    @Override
-    public boolean isVerbose() {
-        return isVerbose;
-    }
-
-    // ---------------------------------------------------------------------------
-
-    private boolean shouldFailOnError;
-
-    @Override
-    public OptionsBuilder shouldFailOnError(boolean value) {
-        shouldFailOnError = value;
-        return this;
-    }
-
-    @Override
-    public boolean shouldFailOnError() {
-        return shouldFailOnError;
-    }
-
-    // ---------------------------------------------------------------------------
-
-    private boolean shouldOutputDetails;
-
-    @Override
-    public OptionsBuilder shouldOutputDetails(boolean value) {
-        shouldOutputDetails = value;
-        return this;
-    }
-
-    @Override
-    public boolean shouldOutputDetailedResults() {
-        return shouldOutputDetails;
-    }
-
-    // ---------------------------------------------------------------------------
-
-    private int threads = -1;
-
-    @Override
-    public OptionsBuilder threads(int count) {
-        this.threads = count;
-        return this;
-    }
-
-    @Override
-    public int getThreads() {
-        return threads;
-    }
-
-    // ---------------------------------------------------------------------------
-
-    private Boolean syncIterations;
-
-    @Override
-    public OptionsBuilder shouldSyncIterations(boolean value) {
-        this.syncIterations = value;
-        return this;
-    }
-
-    @Override
-    public Boolean getSynchIterations() {
-        return syncIterations;
-    }
-
-    // ---------------------------------------------------------------------------
-
-    private int warmupIterations = -1;
-
-    @Override
-    public OptionsBuilder warmupIterations(int value) {
-        this.warmupIterations = value;
-        return this;
-    }
-
-    @Override
-    public int getWarmupIterations() {
-        return warmupIterations;
-    }
-
-    // ---------------------------------------------------------------------------
-
-    private TimeValue warmupTime;
-
-    @Override
-    public OptionsBuilder warmupTime(TimeValue value) {
-        this.warmupTime = value;
-        return this;
-    }
-
-    @Override
-    public TimeValue getWarmupTime() {
-        return warmupTime;
-    }
-
-    // ---------------------------------------------------------------------------
-
-    private WarmupMode warmupMode = WarmupMode.defaultMode();
-
-    @Override
-    public OptionsBuilder warmupMode(WarmupMode mode) {
-        this.warmupMode = mode;
-        return this;
-    }
-
-    @Override
-    public WarmupMode getWarmupMode() {
-        return warmupMode;
-    }
-
-    // ---------------------------------------------------------------------------
-
-    private final List<String> warmupMicros = new ArrayList<String>();
-
-    @Override
-    public OptionsBuilder addWarmupMicro(String regexp) {
-        warmupMicros.add(regexp);
-        return this;
-    }
-
-    @Override
-    public List<String> getWarmupMicros() {
-        return warmupMicros;
-    }
-
-    // ---------------------------------------------------------------------------
-
-    private int iterations = -1;
-
-    @Override
-    public OptionsBuilder iterations(int count) {
-        this.iterations = count;
-        return this;
-    }
-
-    @Override
-    public int getIterations() {
-        return iterations;
-    }
-
-    // ---------------------------------------------------------------------------
-
-    private TimeValue measurementTime;
-
-    @Override
-    public OptionsBuilder measurementTime(TimeValue value) {
-        this.measurementTime = value;
-        return this;
-    }
-
-    @Override
-    public TimeValue getRuntime() {
-        return measurementTime;
-    }
-
-    // ---------------------------------------------------------------------------
-
-    private EnumSet<Mode> benchModes;
-
-    @Override
-    public OptionsBuilder addMode(Mode mode) {
-        if (benchModes == null) {
-            benchModes = EnumSet.noneOf(Mode.class);
-        }
-        benchModes.add(mode);
-        return this;
-    }
-
-    @Override
-    public Collection<Mode> getBenchModes() {
-        return benchModes;
-    }
-
-    // ---------------------------------------------------------------------------
-
-    private TimeUnit timeUnit;
-
-    @Override
-    public OptionsBuilder setTimeUnit(TimeUnit tu) {
-        this.timeUnit = tu;
-        return this;
-    }
-
-    @Override
-    public TimeUnit getTimeUnit() {
-        return timeUnit;
-    }
-
-    // ---------------------------------------------------------------------------
-
-    private int forks = -1;
-
-    @Override
-    public OptionsBuilder forks(int value) {
-        this.forks = value;
-        return this;
-    }
-
-    @Override
-    public int getForkCount() {
-        return forks;
-    }
-
-    // ---------------------------------------------------------------------------
-
-    private int warmupForks = -1;
-
-    @Override
-    public OptionsBuilder warmupForks(int value) {
-        this.warmupForks = value;
-        return this;
-    }
-
-    @Override
-    public int getWarmupForkCount() {
-        return warmupForks;
-    }
-
-    // ---------------------------------------------------------------------------
-
-    private String jvmClassPath;
-
-    @Override
-    public OptionsBuilder classpath(String value) {
-        this.jvmClassPath = value;
-        return this;
-    }
-
-    @Override
-    public String getJvmClassPath() {
-        return jvmClassPath;
-    }
-
-    // ---------------------------------------------------------------------------
-
-    private String jvmBinary;
-
-    @Override
-    public OptionsBuilder jvmBinary(String path) {
-        this.jvmBinary = path;
-        return this;
-    }
-
-    @Override
-    public String getJvm() {
-        return jvmBinary;
-    }
-
-    // ---------------------------------------------------------------------------
-
-    private String jvmArgs;
-
-    @Override
-    public OptionsBuilder jvmArgs(String value) {
-        this.jvmArgs = value;
-        return this;
-    }
-
-    @Override
-    public String getJvmArgs() {
-        return jvmArgs;
-    }
-
-}
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/options/OptionsBuilder.java	Tue Aug 27 17:59:27 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/options/OptionsBuilder.java	Tue Aug 27 18:53:26 2013 +0400
@@ -29,57 +29,391 @@
 import org.openjdk.jmh.profile.ProfilerType;
 import org.openjdk.jmh.runner.parameters.TimeValue;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.EnumSet;
+import java.util.List;
+import java.util.Set;
 import java.util.concurrent.TimeUnit;
 
-public interface OptionsBuilder {
-    Options end();
+public class OptionsBuilder implements Options, ChainedOptionsBuilder {
 
-    OptionsBuilder addBenchmark(String regexp);
+    private boolean finalized;
 
-    OptionsBuilder addExclude(String regexp);
+    private void checkFinalized() {
+        if (finalized) {
+            throw new IllegalStateException("The builder is already finalized");
+        }
+    }
 
-    OptionsBuilder outputFormat(OutputFormatType type);
+    @Override
+    public Options build() {
+        finalized = true;
+        return this;
+    }
 
-    OptionsBuilder setOutput(String filename);
+    // ---------------------------------------------------------------------------
 
-    OptionsBuilder shouldDoGC(boolean value);
+    private final List<String> regexps = new ArrayList<String>();
 
-    OptionsBuilder addProfiler(ProfilerType prof);
+    @Override
+    public ChainedOptionsBuilder include(String regexp) {
+        checkFinalized();
+        regexps.add(regexp);
+        return this;
+    }
 
-    OptionsBuilder shouldBeVerbose(boolean value);
+    @Override
+    public List<String> getRegexps() {
+        return regexps;
+    }
 
-    OptionsBuilder shouldFailOnError(boolean value);
+    // ---------------------------------------------------------------------------
 
-    OptionsBuilder shouldOutputDetails(boolean value);
+    private final List<String> excludes = new ArrayList<String>();
 
-    OptionsBuilder threads(int count);
+    @Override
+    public ChainedOptionsBuilder exclude(String regexp) {
+        excludes.add(regexp);
+        return this;
+    }
 
-    OptionsBuilder shouldSyncIterations(boolean value);
+    @Override
+    public List<String> getExcludes() {
+        return excludes;
+    }
 
-    OptionsBuilder warmupIterations(int value);
+    // ---------------------------------------------------------------------------
 
-    OptionsBuilder warmupTime(TimeValue value);
+    private OutputFormatType ofType = OutputFormatType.defaultType();
 
-    OptionsBuilder warmupMode(WarmupMode mode);
+    @Override
+    public ChainedOptionsBuilder outputFormat(OutputFormatType type) {
+        ofType = type;
+        return this;
+    }
 
-    OptionsBuilder addWarmupMicro(String regexp);
+    @Override
+    public OutputFormatType getOutputFormat() {
+        return ofType;
+    }
 
-    OptionsBuilder iterations(int count);
+    // ---------------------------------------------------------------------------
 
-    OptionsBuilder measurementTime(TimeValue value);
+    private String output;
 
-    OptionsBuilder addMode(Mode mode);
+    @Override
+    public ChainedOptionsBuilder output(String filename) {
+        this.output = filename;
+        return this;
+    }
 
-    OptionsBuilder setTimeUnit(TimeUnit tu);
+    @Override
+    public String getOutput() {
+        return output;
+    }
 
-    OptionsBuilder forks(int value);
+    // ---------------------------------------------------------------------------
 
-    OptionsBuilder warmupForks(int value);
+    private boolean shouldDoGC;
 
-    OptionsBuilder classpath(String value);
+    @Override
+    public ChainedOptionsBuilder shouldDoGC(boolean value) {
+        shouldDoGC = value;
+        return this;
+    }
 
-    OptionsBuilder jvmBinary(String path);
+    @Override
+    public boolean shouldDoGC() {
+        return shouldDoGC;
+    }
 
-    OptionsBuilder jvmArgs(String value);
+    // ---------------------------------------------------------------------------
+
+    private EnumSet<ProfilerType> profilers = EnumSet.noneOf(ProfilerType.class);
+
+    @Override
+    public ChainedOptionsBuilder addProfiler(ProfilerType prof) {
+        this.profilers.add(prof);
+        return this;
+    }
+
+    @Override
+    public Set<ProfilerType> getProfilers() {
+        return profilers;
+    }
+
+    // ---------------------------------------------------------------------------
+
+    private boolean isVerbose;
+
+    @Override
+    public ChainedOptionsBuilder verbose(boolean value) {
+        isVerbose = value;
+        return this;
+    }
+
+    @Override
+    public boolean isVerbose() {
+        return isVerbose;
+    }
+
+    // ---------------------------------------------------------------------------
+
+    private boolean shouldFailOnError;
+
+    @Override
+    public ChainedOptionsBuilder failOnError(boolean value) {
+        shouldFailOnError = value;
+        return this;
+    }
+
+    @Override
+    public boolean shouldFailOnError() {
+        return shouldFailOnError;
+    }
+
+    // ---------------------------------------------------------------------------
+
+    private boolean shouldOutputDetails;
+
+    @Override
+    public ChainedOptionsBuilder outputDetails(boolean value) {
+        shouldOutputDetails = value;
+        return this;
+    }
+
+    @Override
+    public boolean shouldOutputDetailedResults() {
+        return shouldOutputDetails;
+    }
+
+    // ---------------------------------------------------------------------------
+
+    private int threads = -1;
+
+    @Override
+    public ChainedOptionsBuilder threads(int count) {
+        this.threads = count;
+        return this;
+    }
+
+    @Override
+    public int getThreads() {
+        return threads;
+    }
+
+    // ---------------------------------------------------------------------------
+
+    private Boolean syncIterations;
+
+    @Override
+    public ChainedOptionsBuilder syncIterations(boolean value) {
+        this.syncIterations = value;
+        return this;
+    }
+
+    @Override
+    public Boolean getSynchIterations() {
+        return syncIterations;
+    }
+
+    // ---------------------------------------------------------------------------
+
+    private int warmupIterations = -1;
+
+    @Override
+    public ChainedOptionsBuilder warmupIterations(int value) {
+        this.warmupIterations = value;
+        return this;
+    }
+
+    @Override
+    public int getWarmupIterations() {
+        return warmupIterations;
+    }
+
+    // ---------------------------------------------------------------------------
+
+    private TimeValue warmupTime;
+
+    @Override
+    public ChainedOptionsBuilder warmupTime(TimeValue value) {
+        this.warmupTime = value;
+        return this;
+    }
+
+    @Override
+    public TimeValue getWarmupTime() {
+        return warmupTime;
+    }
+
+    // ---------------------------------------------------------------------------
+
+    private WarmupMode warmupMode = WarmupMode.defaultMode();
+
+    @Override
+    public ChainedOptionsBuilder warmupMode(WarmupMode mode) {
+        this.warmupMode = mode;
+        return this;
+    }
+
+    @Override
+    public WarmupMode getWarmupMode() {
+        return warmupMode;
+    }
+
+    // ---------------------------------------------------------------------------
+
+    private final List<String> warmupMicros = new ArrayList<String>();
+
+    @Override
+    public ChainedOptionsBuilder includeWarmup(String regexp) {
+        warmupMicros.add(regexp);
+        return this;
+    }
+
+    @Override
+    public List<String> getWarmupMicros() {
+        return warmupMicros;
+    }
+
+    // ---------------------------------------------------------------------------
+
+    private int iterations = -1;
+
+    @Override
+    public ChainedOptionsBuilder measurementIterations(int count) {
+        this.iterations = count;
+        return this;
+    }
+
+    @Override
+    public int getIterations() {
+        return iterations;
+    }
+
+    // ---------------------------------------------------------------------------
+
+    private TimeValue measurementTime;
+
+    @Override
+    public ChainedOptionsBuilder measurementTime(TimeValue value) {
+        this.measurementTime = value;
+        return this;
+    }
+
+    @Override
+    public TimeValue getRuntime() {
+        return measurementTime;
+    }
+
+    // ---------------------------------------------------------------------------
+
+    private EnumSet<Mode> benchModes;
+
+    @Override
+    public ChainedOptionsBuilder mode(Mode mode) {
+        if (benchModes == null) {
+            benchModes = EnumSet.noneOf(Mode.class);
+        }
+        benchModes.add(mode);
+        return this;
+    }
+
+    @Override
+    public Collection<Mode> getBenchModes() {
+        return benchModes;
+    }
+
+    // ---------------------------------------------------------------------------
+
+    private TimeUnit timeUnit;
+
+    @Override
+    public ChainedOptionsBuilder timeUnit(TimeUnit tu) {
+        this.timeUnit = tu;
+        return this;
+    }
+
+    @Override
+    public TimeUnit getTimeUnit() {
+        return timeUnit;
+    }
+
+    // ---------------------------------------------------------------------------
+
+    private int forks = -1;
+
+    @Override
+    public ChainedOptionsBuilder forks(int value) {
+        this.forks = value;
+        return this;
+    }
+
+    @Override
+    public int getForkCount() {
+        return forks;
+    }
+
+    // ---------------------------------------------------------------------------
+
+    private int warmupForks = -1;
+
+    @Override
+    public ChainedOptionsBuilder warmupForks(int value) {
+        this.warmupForks = value;
+        return this;
+    }
+
+    @Override
+    public int getWarmupForkCount() {
+        return warmupForks;
+    }
+
+    // ---------------------------------------------------------------------------
+
+    private String jvmClassPath;
+
+    @Override
+    public ChainedOptionsBuilder jvmClasspath(String value) {
+        this.jvmClassPath = value;
+        return this;
+    }
+
+    @Override
+    public String getJvmClassPath() {
+        return jvmClassPath;
+    }
+
+    // ---------------------------------------------------------------------------
+
+    private String jvmBinary;
+
+    @Override
+    public ChainedOptionsBuilder jvm(String path) {
+        this.jvmBinary = path;
+        return this;
+    }
+
+    @Override
+    public String getJvm() {
+        return jvmBinary;
+    }
+
+    // ---------------------------------------------------------------------------
+
+    private String jvmArgs;
+
+    @Override
+    public ChainedOptionsBuilder jvmArgs(String value) {
+        this.jvmArgs = value;
+        return this;
+    }
+
+    @Override
+    public String getJvmArgs() {
+        return jvmArgs;
+    }
 
 }
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/parameters/TimeValue.java	Tue Aug 27 17:59:27 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/parameters/TimeValue.java	Tue Aug 27 18:53:26 2013 +0400
@@ -36,6 +36,35 @@
 
     public static final TimeValue NONE = new TimeValue(0, TimeUnit.SECONDS);
 
+
+    public static TimeValue days(long v) {
+        return new TimeValue(v, TimeUnit.DAYS);
+    }
+
+    public static TimeValue hours(long v) {
+        return new TimeValue(v, TimeUnit.HOURS);
+    }
+
+    public static TimeValue microseconds(long v) {
+        return new TimeValue(v, TimeUnit.MICROSECONDS);
+    }
+
+    public static TimeValue milliseconds(long v) {
+        return new TimeValue(v, TimeUnit.MILLISECONDS);
+    }
+
+    public static TimeValue minutes(long v) {
+        return new TimeValue(v, TimeUnit.MINUTES);
+    }
+
+    public static TimeValue nanoseconds(long v) {
+        return new TimeValue(v, TimeUnit.NANOSECONDS);
+    }
+
+    public static TimeValue seconds(long v) {
+        return new TimeValue(v, TimeUnit.SECONDS);
+    }
+
     private final long time;
 
     private final TimeUnit timeUnit;