1 /*
   2  * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package org.openjdk.jmh.runner.options;
  26 
  27 import org.openjdk.jmh.annotations.Mode;
  28 import org.openjdk.jmh.profile.Profiler;
  29 import org.openjdk.jmh.results.format.ResultFormatType;
  30 import org.openjdk.jmh.util.Optional;
  31 
  32 import java.io.Serializable;
  33 import java.util.Collection;
  34 import java.util.List;
  35 import java.util.concurrent.TimeUnit;
  36 
  37 public interface Options extends Serializable {
  38 
  39     /**
  40      * Which benchmarks to execute?
  41      * @return list of regexps matching the requested benchmarks
  42      */
  43     List<String> getIncludes();
  44 
  45     /**
  46      * Which benchmarks to omit?
  47      * @return list of regexps matching the ignored benchmarks
  48      */
  49     List<String> getExcludes();
  50 
  51     /**
  52      * Which file to use for dumping the output
  53      * @return file name
  54      */
  55     Optional<String> getOutput();
  56 
  57     /**
  58      * Result format to use
  59      * @return format type
  60      */
  61     Optional<ResultFormatType> getResultFormat();
  62 
  63     /**
  64      * Which file to use for dumping the result
  65      * @return file name
  66      */
  67     Optional<String> getResult();
  68 
  69     /**
  70      * Should force GC between iterations?
  71      * @return should GC?
  72      */
  73     Optional<Boolean> shouldDoGC();
  74 
  75     /**
  76      * Profilers to use for the run.
  77      * @return profilers to use; empty collection if no profilers are required
  78      */
  79     Collection<Class<? extends Profiler>> getProfilers();
  80 
  81     /**
  82      * How verbose should we be?
  83      * @return verbosity mode
  84      */
  85     Optional<VerboseMode> verbosity();
  86 
  87     /**
  88      * Should harness terminate on first error encountered?
  89      * @return should terminate?
  90      */
  91     Optional<Boolean> shouldFailOnError();
  92 
  93     /**
  94      * Number of threads to run
  95      * @return number of threads; 0 to use maximum number of threads
  96      * @see org.openjdk.jmh.annotations.Threads
  97      */
  98     Optional<Integer> getThreads();
  99 
 100     /**
 101      * Thread subgroups distribution.
 102      * @return array of thread ratios
 103      * @see org.openjdk.jmh.annotations.Group
 104      * @see org.openjdk.jmh.annotations.GroupThreads
 105      */
 106     Optional<int[]> getThreadGroups();
 107 
 108     /**
 109      * Should synchronize iterations?
 110      * @return should we?
 111      */
 112     Optional<Boolean> shouldSyncIterations();
 113 
 114     /**
 115      * Number of warmup iterations
 116      * @return number of warmup iterations
 117      * @see org.openjdk.jmh.annotations.Warmup
 118      */
 119     Optional<Integer> getWarmupIterations();
 120 
 121     /**
 122      * The duration for warmup iterations
 123      * @return duration
 124      * @see org.openjdk.jmh.annotations.Warmup
 125      */
 126     Optional<TimeValue> getWarmupTime();
 127 
 128     /**
 129      * Number of batch size for warmup
 130      * @return number of batch size for warmup
 131      * @see org.openjdk.jmh.annotations.Warmup
 132      */
 133     Optional<Integer> getWarmupBatchSize();
 134 
 135     /**
 136      * Warmup mode.
 137      * @return warmup mode
 138      * @see org.openjdk.jmh.runner.options.WarmupMode
 139      */
 140     Optional<WarmupMode> getWarmupMode();
 141 
 142     /**
 143      * Which benchmarks to warmup before doing the run.
 144      * @return list of regexps matching the relevant benchmarks; empty if no benchmarks are defined
 145      */
 146     List<String> getWarmupIncludes();
 147 
 148     /**
 149      * Number of measurement iterations
 150      * @return number of measurement iterations
 151      * @see org.openjdk.jmh.annotations.Measurement
 152      */
 153     Optional<Integer> getMeasurementIterations();
 154 
 155     /**
 156      * The duration for measurement iterations
 157      * @return duration
 158      * @see org.openjdk.jmh.annotations.Measurement
 159      */
 160     Optional<TimeValue> getMeasurementTime();
 161 
 162     /**
 163      * Number of batch size for measurement
 164      * @return number of batch size for measurement
 165      * @see org.openjdk.jmh.annotations.Measurement
 166      */
 167     Optional<Integer> getMeasurementBatchSize();
 168 
 169     /**
 170      * Benchmarks modes to execute.
 171      * @return modes to execute the benchmarks in; empty to use the default modes
 172      * @see org.openjdk.jmh.annotations.BenchmarkMode
 173      */
 174     Collection<Mode> getBenchModes();
 175 
 176     /**
 177      * Timeunit to use in units.
 178      * @return timeunit
 179      * @see org.openjdk.jmh.annotations.OutputTimeUnit
 180      */
 181     Optional<TimeUnit> getTimeUnit();
 182 
 183     /**
 184      * Operations per invocation.
 185      * @return operations per invocation.
 186      * @see org.openjdk.jmh.annotations.OperationsPerInvocation
 187      */
 188     Optional<Integer> getOperationsPerInvocation();
 189 
 190     /**
 191      * Fork count
 192      * @return fork count; 0, to prohibit forking
 193      * @see org.openjdk.jmh.annotations.Fork
 194      */
 195     Optional<Integer> getForkCount();
 196 
 197     /**
 198      * Number of initial forks to ignore the results for
 199      * @return initial fork count; 0, to disable
 200      * @see org.openjdk.jmh.annotations.Fork
 201      */
 202     Optional<Integer> getWarmupForkCount();
 203 
 204     /**
 205      * JVM executable to use for forks
 206      * @return path to JVM executable
 207      */
 208     Optional<String> getJvm();
 209 
 210     /**
 211      * JVM parameters to use with forks
 212      * @return JVM parameters
 213      * @see org.openjdk.jmh.annotations.Fork
 214      */
 215     Optional<Collection<String>> getJvmArgs();
 216 
 217     /**
 218      * JVM parameters to use with forks (these options will be appended
 219      * after any other JVM option)
 220      * @return JVM parameters
 221      * @see org.openjdk.jmh.annotations.Fork
 222      */
 223     Optional<Collection<String>> getJvmArgsAppend();
 224 
 225     /**
 226      * JVM parameters to use with forks (these options will be prepended
 227      * before any other JVM option)
 228      * @return JVM parameters
 229      * @see org.openjdk.jmh.annotations.Fork
 230      */
 231     Optional<Collection<String>> getJvmArgsPrepend();
 232 
 233     /**
 234      * The overridden value of the parameter.
 235      * @param name parameter name
 236      * @return parameter
 237      * @see org.openjdk.jmh.annotations.Param
 238      */
 239     Optional<Collection<String>> getParameter(String name);
 240 
 241 }