Package org.openjdk.jmh.runner.options
Class CommandLineOptions
- java.lang.Object
-
- org.openjdk.jmh.runner.options.CommandLineOptions
-
- All Implemented Interfaces:
java.io.Serializable,Options
public class CommandLineOptions extends java.lang.Object implements Options
Class that handles all the command line options.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private Optional<java.lang.Integer>batchSizeprivate java.util.List<Mode>benchModeprivate java.util.List<java.lang.String>excludesprivate Optional<java.lang.Boolean>failOnErrorprivate Optional<java.lang.Integer>forkprivate Optional<java.lang.Boolean>gcEachIterationprivate booleanhelpprivate Optional<java.lang.Integer>iterationsprivate Optional<java.lang.String>jvmprivate Optional<java.util.Collection<java.lang.String>>jvmArgsprivate Optional<java.util.Collection<java.lang.String>>jvmArgsAppendprivate Optional<java.util.Collection<java.lang.String>>jvmArgsPrependprivate booleanlistprivate booleanlistProfilersprivate booleanlistResultFormatsprivate booleanlistWithParamsprivate Optional<java.lang.Integer>opsPerInvocationprivate Optional<java.lang.String>outputprivate Multimap<java.lang.String,java.lang.String>paramsprivate joptsimple.OptionParserparserprivate java.util.List<ProfilerConfig>profilersprivate java.util.List<java.lang.String>regexpsprivate Optional<java.lang.String>resultprivate Optional<ResultFormatType>resultFormatprivate Optional<TimeValue>runTimeprivate static longserialVersionUIDprivate Optional<java.lang.Boolean>synchIterationsprivate java.util.List<java.lang.Integer>threadGroupsprivate Optional<java.lang.Integer>threadsprivate Optional<TimeValue>timeoutprivate Optional<java.util.concurrent.TimeUnit>timeUnitprivate Optional<VerboseMode>verboseprivate Optional<java.lang.Integer>warmupBatchSizeprivate Optional<java.lang.Integer>warmupForkprivate Optional<java.lang.Integer>warmupIterationsprivate java.util.List<java.lang.String>warmupMicrosprivate Optional<WarmupMode>warmupModeprivate Optional<TimeValue>warmupTime
-
Constructor Summary
Constructors Constructor Description CommandLineOptions(java.lang.String... argv)Parses the given command line.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Collection<Mode>getBenchModes()Benchmarks modes to execute.java.util.List<java.lang.String>getExcludes()Which benchmarks to omit?Optional<java.lang.Integer>getForkCount()Fork countjava.util.List<java.lang.String>getIncludes()Which benchmarks to execute?Optional<java.lang.String>getJvm()JVM executable to use for forksOptional<java.util.Collection<java.lang.String>>getJvmArgs()JVM parameters to use with forksOptional<java.util.Collection<java.lang.String>>getJvmArgsAppend()JVM parameters to use with forks (these options will be appended after any other JVM option)Optional<java.util.Collection<java.lang.String>>getJvmArgsPrepend()JVM parameters to use with forks (these options will be prepended before any other JVM option)Optional<java.lang.Integer>getMeasurementBatchSize()Number of batch size for measurementOptional<java.lang.Integer>getMeasurementIterations()Number of measurement iterationsOptional<TimeValue>getMeasurementTime()The duration for measurement iterationsOptional<java.lang.Integer>getOperationsPerInvocation()Operations per invocation.Optional<java.lang.String>getOutput()Which file to use for dumping the outputOptional<java.util.Collection<java.lang.String>>getParameter(java.lang.String name)The overridden value of the parameter.java.util.List<ProfilerConfig>getProfilers()Profilers to use for the run.Optional<java.lang.String>getResult()Which file to use for dumping the resultOptional<ResultFormatType>getResultFormat()Result format to useOptional<int[]>getThreadGroups()Thread subgroups distribution.Optional<java.lang.Integer>getThreads()Number of threads to runOptional<TimeValue>getTimeout()Timeout: how long to wait for an iteration to complete.Optional<java.util.concurrent.TimeUnit>getTimeUnit()Timeunit to use in units.Optional<java.lang.Integer>getWarmupBatchSize()Number of batch size for warmupOptional<java.lang.Integer>getWarmupForkCount()Number of initial forks to ignore the results forjava.util.List<java.lang.String>getWarmupIncludes()Which benchmarks to warmup before doing the run.Optional<java.lang.Integer>getWarmupIterations()Number of warmup iterationsOptional<WarmupMode>getWarmupMode()Warmup mode.Optional<TimeValue>getWarmupTime()The duration for warmup iterationsvoidlistProfilers()voidlistResultFormats()Optional<java.lang.Boolean>shouldDoGC()Should force GC between iterations?Optional<java.lang.Boolean>shouldFailOnError()Should harness terminate on first error encountered?booleanshouldHelp()booleanshouldList()booleanshouldListProfilers()booleanshouldListResultFormats()booleanshouldListWithParams()Optional<java.lang.Boolean>shouldSyncIterations()Should synchronize iterations?voidshowHelp()private static <T> Optional<T>toOptional(joptsimple.OptionSpec<T> option, joptsimple.OptionSet set)Optional<java.util.Collection<java.lang.String>>treatQuoted(joptsimple.OptionSet set, joptsimple.OptionSpec<java.lang.String> spec)Optional<VerboseMode>verbosity()How verbose should we be?private java.lang.StringwarmupModesDesc()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
iterations
private final Optional<java.lang.Integer> iterations
-
batchSize
private final Optional<java.lang.Integer> batchSize
-
warmupIterations
private final Optional<java.lang.Integer> warmupIterations
-
warmupBatchSize
private final Optional<java.lang.Integer> warmupBatchSize
-
benchMode
private final java.util.List<Mode> benchMode
-
threads
private final Optional<java.lang.Integer> threads
-
threadGroups
private final java.util.List<java.lang.Integer> threadGroups
-
synchIterations
private final Optional<java.lang.Boolean> synchIterations
-
gcEachIteration
private final Optional<java.lang.Boolean> gcEachIteration
-
verbose
private final Optional<VerboseMode> verbose
-
failOnError
private final Optional<java.lang.Boolean> failOnError
-
profilers
private final java.util.List<ProfilerConfig> profilers
-
timeUnit
private final Optional<java.util.concurrent.TimeUnit> timeUnit
-
opsPerInvocation
private final Optional<java.lang.Integer> opsPerInvocation
-
regexps
private final java.util.List<java.lang.String> regexps
-
fork
private final Optional<java.lang.Integer> fork
-
warmupFork
private final Optional<java.lang.Integer> warmupFork
-
output
private final Optional<java.lang.String> output
-
result
private final Optional<java.lang.String> result
-
resultFormat
private final Optional<ResultFormatType> resultFormat
-
jvm
private final Optional<java.lang.String> jvm
-
jvmArgs
private final Optional<java.util.Collection<java.lang.String>> jvmArgs
-
jvmArgsAppend
private final Optional<java.util.Collection<java.lang.String>> jvmArgsAppend
-
jvmArgsPrepend
private final Optional<java.util.Collection<java.lang.String>> jvmArgsPrepend
-
excludes
private final java.util.List<java.lang.String> excludes
-
warmupMode
private final Optional<WarmupMode> warmupMode
-
warmupMicros
private final java.util.List<java.lang.String> warmupMicros
-
params
private final Multimap<java.lang.String,java.lang.String> params
-
list
private final boolean list
-
listWithParams
private final boolean listWithParams
-
listResultFormats
private final boolean listResultFormats
-
help
private final boolean help
-
listProfilers
private final boolean listProfilers
-
parser
private final transient joptsimple.OptionParser parser
-
-
Constructor Detail
-
CommandLineOptions
public CommandLineOptions(java.lang.String... argv) throws CommandLineOptionExceptionParses the given command line.- Parameters:
argv- argument list- Throws:
CommandLineOptionException- if some options are misspelled
-
-
Method Detail
-
warmupModesDesc
private java.lang.String warmupModesDesc()
-
toOptional
private static <T> Optional<T> toOptional(joptsimple.OptionSpec<T> option, joptsimple.OptionSet set)
-
treatQuoted
public Optional<java.util.Collection<java.lang.String>> treatQuoted(joptsimple.OptionSet set, joptsimple.OptionSpec<java.lang.String> spec)
-
showHelp
public void showHelp() throws java.io.IOException- Throws:
java.io.IOException
-
listProfilers
public void listProfilers()
-
listResultFormats
public void listResultFormats()
-
shouldList
public boolean shouldList()
-
shouldListWithParams
public boolean shouldListWithParams()
-
shouldListResultFormats
public boolean shouldListResultFormats()
-
shouldHelp
public boolean shouldHelp()
-
shouldListProfilers
public boolean shouldListProfilers()
-
getWarmupMode
public Optional<WarmupMode> getWarmupMode()
Description copied from interface:OptionsWarmup mode.- Specified by:
getWarmupModein interfaceOptions- Returns:
- warmup mode
- See Also:
WarmupMode
-
getIncludes
public java.util.List<java.lang.String> getIncludes()
Description copied from interface:OptionsWhich benchmarks to execute?- Specified by:
getIncludesin interfaceOptions- Returns:
- list of regexps matching the requested benchmarks
-
getExcludes
public java.util.List<java.lang.String> getExcludes()
Description copied from interface:OptionsWhich benchmarks to omit?- Specified by:
getExcludesin interfaceOptions- Returns:
- list of regexps matching the ignored benchmarks
-
getWarmupIncludes
public java.util.List<java.lang.String> getWarmupIncludes()
Description copied from interface:OptionsWhich benchmarks to warmup before doing the run.- Specified by:
getWarmupIncludesin interfaceOptions- Returns:
- list of regexps matching the relevant benchmarks; empty if no benchmarks are defined
-
getJvm
public Optional<java.lang.String> getJvm()
Description copied from interface:OptionsJVM executable to use for forks
-
getJvmArgs
public Optional<java.util.Collection<java.lang.String>> getJvmArgs()
Description copied from interface:OptionsJVM parameters to use with forks- Specified by:
getJvmArgsin interfaceOptions- Returns:
- JVM parameters
- See Also:
Fork
-
getJvmArgsAppend
public Optional<java.util.Collection<java.lang.String>> getJvmArgsAppend()
Description copied from interface:OptionsJVM parameters to use with forks (these options will be appended after any other JVM option)- Specified by:
getJvmArgsAppendin interfaceOptions- Returns:
- JVM parameters
- See Also:
Fork
-
getJvmArgsPrepend
public Optional<java.util.Collection<java.lang.String>> getJvmArgsPrepend()
Description copied from interface:OptionsJVM parameters to use with forks (these options will be prepended before any other JVM option)- Specified by:
getJvmArgsPrependin interfaceOptions- Returns:
- JVM parameters
- See Also:
Fork
-
getParameter
public Optional<java.util.Collection<java.lang.String>> getParameter(java.lang.String name)
Description copied from interface:OptionsThe overridden value of the parameter.- Specified by:
getParameterin interfaceOptions- Parameters:
name- parameter name- Returns:
- parameter
- See Also:
Param
-
getForkCount
public Optional<java.lang.Integer> getForkCount()
Description copied from interface:OptionsFork count- Specified by:
getForkCountin interfaceOptions- Returns:
- fork count; 0, to prohibit forking
- See Also:
Fork
-
getWarmupForkCount
public Optional<java.lang.Integer> getWarmupForkCount()
Description copied from interface:OptionsNumber of initial forks to ignore the results for- Specified by:
getWarmupForkCountin interfaceOptions- Returns:
- initial fork count; 0, to disable
- See Also:
Fork
-
getOutput
public Optional<java.lang.String> getOutput()
Description copied from interface:OptionsWhich file to use for dumping the output
-
getResultFormat
public Optional<ResultFormatType> getResultFormat()
Description copied from interface:OptionsResult format to use- Specified by:
getResultFormatin interfaceOptions- Returns:
- format type
-
getResult
public Optional<java.lang.String> getResult()
Description copied from interface:OptionsWhich file to use for dumping the result
-
getMeasurementIterations
public Optional<java.lang.Integer> getMeasurementIterations()
Description copied from interface:OptionsNumber of measurement iterations- Specified by:
getMeasurementIterationsin interfaceOptions- Returns:
- number of measurement iterations
- See Also:
Measurement
-
getMeasurementBatchSize
public Optional<java.lang.Integer> getMeasurementBatchSize()
Description copied from interface:OptionsNumber of batch size for measurement- Specified by:
getMeasurementBatchSizein interfaceOptions- Returns:
- number of batch size for measurement
- See Also:
Measurement
-
getMeasurementTime
public Optional<TimeValue> getMeasurementTime()
Description copied from interface:OptionsThe duration for measurement iterations- Specified by:
getMeasurementTimein interfaceOptions- Returns:
- duration
- See Also:
Measurement
-
getWarmupTime
public Optional<TimeValue> getWarmupTime()
Description copied from interface:OptionsThe duration for warmup iterations- Specified by:
getWarmupTimein interfaceOptions- Returns:
- duration
- See Also:
Warmup
-
getWarmupIterations
public Optional<java.lang.Integer> getWarmupIterations()
Description copied from interface:OptionsNumber of warmup iterations- Specified by:
getWarmupIterationsin interfaceOptions- Returns:
- number of warmup iterations
- See Also:
Warmup
-
getWarmupBatchSize
public Optional<java.lang.Integer> getWarmupBatchSize()
Description copied from interface:OptionsNumber of batch size for warmup- Specified by:
getWarmupBatchSizein interfaceOptions- Returns:
- number of batch size for warmup
- See Also:
Warmup
-
getThreads
public Optional<java.lang.Integer> getThreads()
Description copied from interface:OptionsNumber of threads to run- Specified by:
getThreadsin interfaceOptions- Returns:
- number of threads; 0 to use maximum number of threads
- See Also:
Threads
-
getThreadGroups
public Optional<int[]> getThreadGroups()
Description copied from interface:OptionsThread subgroups distribution.- Specified by:
getThreadGroupsin interfaceOptions- Returns:
- array of thread ratios
- See Also:
Group,GroupThreads
-
shouldDoGC
public Optional<java.lang.Boolean> shouldDoGC()
Description copied from interface:OptionsShould force GC between iterations?- Specified by:
shouldDoGCin interfaceOptions- Returns:
- should GC?
-
shouldSyncIterations
public Optional<java.lang.Boolean> shouldSyncIterations()
Description copied from interface:OptionsShould synchronize iterations?- Specified by:
shouldSyncIterationsin interfaceOptions- Returns:
- should we?
-
verbosity
public Optional<VerboseMode> verbosity()
Description copied from interface:OptionsHow verbose should we be?
-
getTimeUnit
public Optional<java.util.concurrent.TimeUnit> getTimeUnit()
Description copied from interface:OptionsTimeunit to use in units.- Specified by:
getTimeUnitin interfaceOptions- Returns:
- timeunit
- See Also:
OutputTimeUnit
-
getOperationsPerInvocation
public Optional<java.lang.Integer> getOperationsPerInvocation()
Description copied from interface:OptionsOperations per invocation.- Specified by:
getOperationsPerInvocationin interfaceOptions- Returns:
- operations per invocation.
- See Also:
OperationsPerInvocation
-
shouldFailOnError
public Optional<java.lang.Boolean> shouldFailOnError()
Description copied from interface:OptionsShould harness terminate on first error encountered?- Specified by:
shouldFailOnErrorin interfaceOptions- Returns:
- should terminate?
-
getProfilers
public java.util.List<ProfilerConfig> getProfilers()
Description copied from interface:OptionsProfilers to use for the run. Profilers will start in the order specified by collection, and will stop in the reverse order.- Specified by:
getProfilersin interfaceOptions- Returns:
- profilers to use; empty collection if no profilers are required
-
getBenchModes
public java.util.Collection<Mode> getBenchModes()
Description copied from interface:OptionsBenchmarks modes to execute.- Specified by:
getBenchModesin interfaceOptions- Returns:
- modes to execute the benchmarks in; empty to use the default modes
- See Also:
BenchmarkMode
-
getTimeout
public Optional<TimeValue> getTimeout()
Description copied from interface:OptionsTimeout: how long to wait for an iteration to complete.- Specified by:
getTimeoutin interfaceOptions- Returns:
- duration
-
-