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>
batchSize
private java.util.List<Mode>
benchMode
private java.util.List<java.lang.String>
excludes
private Optional<java.lang.Boolean>
failOnError
private Optional<java.lang.Integer>
fork
private Optional<java.lang.Boolean>
gcEachIteration
private boolean
help
private Optional<java.lang.Integer>
iterations
private Optional<java.lang.String>
jvm
private Optional<java.util.Collection<java.lang.String>>
jvmArgs
private Optional<java.util.Collection<java.lang.String>>
jvmArgsAppend
private Optional<java.util.Collection<java.lang.String>>
jvmArgsPrepend
private boolean
list
private boolean
listProfilers
private boolean
listResultFormats
private boolean
listWithParams
private Optional<java.lang.Integer>
opsPerInvocation
private Optional<java.lang.String>
output
private Multimap<java.lang.String,java.lang.String>
params
private joptsimple.OptionParser
parser
private java.util.List<ProfilerConfig>
profilers
private java.util.List<java.lang.String>
regexps
private Optional<java.lang.String>
result
private Optional<ResultFormatType>
resultFormat
private Optional<TimeValue>
runTime
private static long
serialVersionUID
private Optional<java.lang.Boolean>
synchIterations
private java.util.List<java.lang.Integer>
threadGroups
private Optional<java.lang.Integer>
threads
private Optional<TimeValue>
timeout
private Optional<java.util.concurrent.TimeUnit>
timeUnit
private Optional<VerboseMode>
verbose
private Optional<java.lang.Integer>
warmupBatchSize
private Optional<java.lang.Integer>
warmupFork
private Optional<java.lang.Integer>
warmupIterations
private java.util.List<java.lang.String>
warmupMicros
private Optional<WarmupMode>
warmupMode
private 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 iterationsvoid
listProfilers()
void
listResultFormats()
Optional<java.lang.Boolean>
shouldDoGC()
Should force GC between iterations?Optional<java.lang.Boolean>
shouldFailOnError()
Should harness terminate on first error encountered?boolean
shouldHelp()
boolean
shouldList()
boolean
shouldListProfilers()
boolean
shouldListResultFormats()
boolean
shouldListWithParams()
Optional<java.lang.Boolean>
shouldSyncIterations()
Should synchronize iterations?void
showHelp()
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.String
warmupModesDesc()
-
-
-
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 CommandLineOptionException
Parses 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:Options
Warmup mode.- Specified by:
getWarmupMode
in interfaceOptions
- Returns:
- warmup mode
- See Also:
WarmupMode
-
getIncludes
public java.util.List<java.lang.String> getIncludes()
Description copied from interface:Options
Which benchmarks to execute?- Specified by:
getIncludes
in interfaceOptions
- Returns:
- list of regexps matching the requested benchmarks
-
getExcludes
public java.util.List<java.lang.String> getExcludes()
Description copied from interface:Options
Which benchmarks to omit?- Specified by:
getExcludes
in interfaceOptions
- Returns:
- list of regexps matching the ignored benchmarks
-
getWarmupIncludes
public java.util.List<java.lang.String> getWarmupIncludes()
Description copied from interface:Options
Which benchmarks to warmup before doing the run.- Specified by:
getWarmupIncludes
in 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:Options
JVM executable to use for forks
-
getJvmArgs
public Optional<java.util.Collection<java.lang.String>> getJvmArgs()
Description copied from interface:Options
JVM parameters to use with forks- Specified by:
getJvmArgs
in interfaceOptions
- Returns:
- JVM parameters
- See Also:
Fork
-
getJvmArgsAppend
public Optional<java.util.Collection<java.lang.String>> getJvmArgsAppend()
Description copied from interface:Options
JVM parameters to use with forks (these options will be appended after any other JVM option)- Specified by:
getJvmArgsAppend
in interfaceOptions
- Returns:
- JVM parameters
- See Also:
Fork
-
getJvmArgsPrepend
public Optional<java.util.Collection<java.lang.String>> getJvmArgsPrepend()
Description copied from interface:Options
JVM parameters to use with forks (these options will be prepended before any other JVM option)- Specified by:
getJvmArgsPrepend
in 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:Options
The overridden value of the parameter.- Specified by:
getParameter
in interfaceOptions
- Parameters:
name
- parameter name- Returns:
- parameter
- See Also:
Param
-
getForkCount
public Optional<java.lang.Integer> getForkCount()
Description copied from interface:Options
Fork count- Specified by:
getForkCount
in interfaceOptions
- Returns:
- fork count; 0, to prohibit forking
- See Also:
Fork
-
getWarmupForkCount
public Optional<java.lang.Integer> getWarmupForkCount()
Description copied from interface:Options
Number of initial forks to ignore the results for- Specified by:
getWarmupForkCount
in interfaceOptions
- Returns:
- initial fork count; 0, to disable
- See Also:
Fork
-
getOutput
public Optional<java.lang.String> getOutput()
Description copied from interface:Options
Which file to use for dumping the output
-
getResultFormat
public Optional<ResultFormatType> getResultFormat()
Description copied from interface:Options
Result format to use- Specified by:
getResultFormat
in interfaceOptions
- Returns:
- format type
-
getResult
public Optional<java.lang.String> getResult()
Description copied from interface:Options
Which file to use for dumping the result
-
getMeasurementIterations
public Optional<java.lang.Integer> getMeasurementIterations()
Description copied from interface:Options
Number of measurement iterations- Specified by:
getMeasurementIterations
in interfaceOptions
- Returns:
- number of measurement iterations
- See Also:
Measurement
-
getMeasurementBatchSize
public Optional<java.lang.Integer> getMeasurementBatchSize()
Description copied from interface:Options
Number of batch size for measurement- Specified by:
getMeasurementBatchSize
in interfaceOptions
- Returns:
- number of batch size for measurement
- See Also:
Measurement
-
getMeasurementTime
public Optional<TimeValue> getMeasurementTime()
Description copied from interface:Options
The duration for measurement iterations- Specified by:
getMeasurementTime
in interfaceOptions
- Returns:
- duration
- See Also:
Measurement
-
getWarmupTime
public Optional<TimeValue> getWarmupTime()
Description copied from interface:Options
The duration for warmup iterations- Specified by:
getWarmupTime
in interfaceOptions
- Returns:
- duration
- See Also:
Warmup
-
getWarmupIterations
public Optional<java.lang.Integer> getWarmupIterations()
Description copied from interface:Options
Number of warmup iterations- Specified by:
getWarmupIterations
in interfaceOptions
- Returns:
- number of warmup iterations
- See Also:
Warmup
-
getWarmupBatchSize
public Optional<java.lang.Integer> getWarmupBatchSize()
Description copied from interface:Options
Number of batch size for warmup- Specified by:
getWarmupBatchSize
in interfaceOptions
- Returns:
- number of batch size for warmup
- See Also:
Warmup
-
getThreads
public Optional<java.lang.Integer> getThreads()
Description copied from interface:Options
Number of threads to run- Specified by:
getThreads
in interfaceOptions
- Returns:
- number of threads; 0 to use maximum number of threads
- See Also:
Threads
-
getThreadGroups
public Optional<int[]> getThreadGroups()
Description copied from interface:Options
Thread subgroups distribution.- Specified by:
getThreadGroups
in interfaceOptions
- Returns:
- array of thread ratios
- See Also:
Group
,GroupThreads
-
shouldDoGC
public Optional<java.lang.Boolean> shouldDoGC()
Description copied from interface:Options
Should force GC between iterations?- Specified by:
shouldDoGC
in interfaceOptions
- Returns:
- should GC?
-
shouldSyncIterations
public Optional<java.lang.Boolean> shouldSyncIterations()
Description copied from interface:Options
Should synchronize iterations?- Specified by:
shouldSyncIterations
in interfaceOptions
- Returns:
- should we?
-
verbosity
public Optional<VerboseMode> verbosity()
Description copied from interface:Options
How verbose should we be?
-
getTimeUnit
public Optional<java.util.concurrent.TimeUnit> getTimeUnit()
Description copied from interface:Options
Timeunit to use in units.- Specified by:
getTimeUnit
in interfaceOptions
- Returns:
- timeunit
- See Also:
OutputTimeUnit
-
getOperationsPerInvocation
public Optional<java.lang.Integer> getOperationsPerInvocation()
Description copied from interface:Options
Operations per invocation.- Specified by:
getOperationsPerInvocation
in interfaceOptions
- Returns:
- operations per invocation.
- See Also:
OperationsPerInvocation
-
shouldFailOnError
public Optional<java.lang.Boolean> shouldFailOnError()
Description copied from interface:Options
Should harness terminate on first error encountered?- Specified by:
shouldFailOnError
in interfaceOptions
- Returns:
- should terminate?
-
getProfilers
public java.util.List<ProfilerConfig> getProfilers()
Description copied from interface:Options
Profilers to use for the run. Profilers will start in the order specified by collection, and will stop in the reverse order.- Specified by:
getProfilers
in interfaceOptions
- Returns:
- profilers to use; empty collection if no profilers are required
-
getBenchModes
public java.util.Collection<Mode> getBenchModes()
Description copied from interface:Options
Benchmarks modes to execute.- Specified by:
getBenchModes
in 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:Options
Timeout: how long to wait for an iteration to complete.- Specified by:
getTimeout
in interfaceOptions
- Returns:
- duration
-
-