Package org.openjdk.jmh.runner.options
Class OptionsBuilder
java.lang.Object
org.openjdk.jmh.runner.options.OptionsBuilder
- All Implemented Interfaces:
Serializable
,ChainedOptionsBuilder
,Options
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Optional
<Collection<String>> private Optional
<Collection<String>> private Optional
<Collection<String>> private Options
private final List
<ProfilerConfig> private Optional
<ResultFormatType> private static final long
private Optional
<int[]> private Optional
<VerboseMode> private Optional
<WarmupMode> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddProfiler
(Class<? extends Profiler> prof) Add the profiler in the runaddProfiler
(Class<? extends Profiler> prof, String initLine) Add the profiler in the runaddProfiler
(String prof) Add the profiler in the runaddProfiler
(String prof, String initLine) Add the profiler in the runbuild()
Produce the final Optionsprivate static void
checkGreaterOrEqual
(int value, int minValue, String s) Autodetect forked JVM arguments from the parent VM.Exclude benchmarks from the run (Can be used multiple times)forks
(int value) Number of forks to use in the runBenchmarks modes to execute.Which benchmarks to omit?Fork countWhich benchmarks to execute?getJvm()
JVM executable to use for forksJVM parameters to use with forksJVM parameters to use with forks (these options will be appended after any other JVM option)JVM parameters to use with forks (these options will be prepended before any other JVM option)Number of batch size for measurementNumber of measurement iterationsThe duration for measurement iterationsOperations per invocation.Which file to use for dumping the outputgetParameter
(String name) The overridden value of the parameter.Profilers to use for the run.Which file to use for dumping the resultResult format to useOptional
<int[]> Thread subgroups distribution.Number of threads to runTimeout: how long to wait for an iteration to complete.Timeunit to use in units.Number of batch size for warmupNumber of initial forks to ignore the results forWhich benchmarks to warmup before doing the run.Number of warmup iterationsWarmup mode.The duration for warmup iterationsInclude benchmark in the run (Can be used multiple times)includeWarmup
(String regexp) What other benchmarks to warmup along the wayForked JVM to use.Forked JVM arguments.jvmArgsAppend
(String... value) Append forked JVM arguments: These options go after other options.jvmArgsPrepend
(String... value) Prepend forked JVM arguments: These options go before any other options.measurementBatchSize
(int value) How large measurement batchSize should be?measurementIterations
(int count) How many measurement measurementIterations to domeasurementTime
(TimeValue value) How long each measurement iteration should take?Benchmark mode.operationsPerInvocation
(int opsPerInv) Operations per invocation.Output filename to write the run log toSet benchmark parameter values.Override the defaults from the given option.Output filename to write the result toresultFormat
(ResultFormatType type) ResultFormatType to use in the runShould force GC between iterations?shouldDoGC
(boolean value) Should do GC between measurementIterations?Should harness terminate on first error encountered?shouldFailOnError
(boolean value) Should fail on first benchmark error?Should synchronize iterations?syncIterations
(boolean value) Should synchronize measurementIterations?threadGroups
(int... groups) Subgroups thread distribution.threads
(int count) Number of threads to run the benchmark inHow long to wait for iteration execution?Timeunit to use in resultsHow verbose should we be?verbosity
(VerboseMode mode) Control verbosity level.warmupBatchSize
(int value) How large warmup batchSize should be?warmupForks
(int value) Number of ignored forkswarmupIterations
(int value) How many warmup iterations to do?warmupMode
(WarmupMode mode) Warmup mode to usewarmupTime
(TimeValue value) How long each warmup iteration should take?
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
otherOptions
-
regexps
-
excludes
-
output
-
rfType
-
result
-
shouldDoGC
-
profilers
-
verbosity
-
shouldFailOnError
-
threads
-
threadGroups
-
syncIterations
-
warmupIterations
-
warmupBatchSize
-
warmupTime
-
warmupMode
-
warmupMicros
-
iterations
-
measurementTime
-
measurementBatchSize
-
benchModes
-
timeUnit
-
opsPerInvocation
-
forks
-
warmupForks
-
jvmBinary
-
jvmArgs
-
jvmArgsAppend
-
jvmArgsPrepend
-
params
-
timeout
-
-
Constructor Details
-
OptionsBuilder
public OptionsBuilder()
-
-
Method Details
-
build
Description copied from interface:ChainedOptionsBuilder
Produce the final Options- Specified by:
build
in interfaceChainedOptionsBuilder
- Returns:
- options object.
-
parent
Description copied from interface:ChainedOptionsBuilder
Override the defaults from the given option. You may use this only once.- Specified by:
parent
in interfaceChainedOptionsBuilder
- Parameters:
other
- options to base on- Returns:
- builder
-
checkGreaterOrEqual
-
include
Description copied from interface:ChainedOptionsBuilder
Include benchmark in the run (Can be used multiple times)- Specified by:
include
in interfaceChainedOptionsBuilder
- Parameters:
regexp
- to match benchmarks against- Returns:
- builder
- See Also:
-
getIncludes
Description copied from interface:Options
Which benchmarks to execute?- Specified by:
getIncludes
in interfaceOptions
- Returns:
- list of regexps matching the requested benchmarks
-
exclude
Description copied from interface:ChainedOptionsBuilder
Exclude benchmarks from the run (Can be used multiple times)- Specified by:
exclude
in interfaceChainedOptionsBuilder
- Parameters:
regexp
- to match benchmark against- Returns:
- builder
-
getExcludes
Description copied from interface:Options
Which benchmarks to omit?- Specified by:
getExcludes
in interfaceOptions
- Returns:
- list of regexps matching the ignored benchmarks
-
output
Description copied from interface:ChainedOptionsBuilder
Output filename to write the run log to- Specified by:
output
in interfaceChainedOptionsBuilder
- Parameters:
filename
- file name- Returns:
- builder
-
getOutput
Description copied from interface:Options
Which file to use for dumping the output -
resultFormat
Description copied from interface:ChainedOptionsBuilder
ResultFormatType to use in the run- Specified by:
resultFormat
in interfaceChainedOptionsBuilder
- Parameters:
type
- resultformat type- Returns:
- builder
- See Also:
-
getResultFormat
Description copied from interface:Options
Result format to use- Specified by:
getResultFormat
in interfaceOptions
- Returns:
- format type
-
result
Description copied from interface:ChainedOptionsBuilder
Output filename to write the result to- Specified by:
result
in interfaceChainedOptionsBuilder
- Parameters:
filename
- file name- Returns:
- builder
- See Also:
-
getResult
Description copied from interface:Options
Which file to use for dumping the result -
shouldDoGC
Description copied from interface:ChainedOptionsBuilder
Should do GC between measurementIterations?- Specified by:
shouldDoGC
in interfaceChainedOptionsBuilder
- Parameters:
value
- flag- Returns:
- builder
- See Also:
-
shouldDoGC
Description copied from interface:Options
Should force GC between iterations?- Specified by:
shouldDoGC
in interfaceOptions
- Returns:
- should GC?
-
addProfiler
Description copied from interface:ChainedOptionsBuilder
Add the profiler in the run- Specified by:
addProfiler
in interfaceChainedOptionsBuilder
- Parameters:
prof
- profiler class- Returns:
- builder
-
addProfiler
Description copied from interface:ChainedOptionsBuilder
Add the profiler in the run- Specified by:
addProfiler
in interfaceChainedOptionsBuilder
- Parameters:
prof
- profiler classinitLine
- profiler options initialization line- Returns:
- builder
-
addProfiler
Description copied from interface:ChainedOptionsBuilder
Add the profiler in the run- Specified by:
addProfiler
in interfaceChainedOptionsBuilder
- Parameters:
prof
- profiler class name, or profiler alias- Returns:
- builder
-
addProfiler
Description copied from interface:ChainedOptionsBuilder
Add the profiler in the run- Specified by:
addProfiler
in interfaceChainedOptionsBuilder
- Parameters:
prof
- profiler class name, or profiler aliasinitLine
- profiler options initialization line- Returns:
- builder
-
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
-
verbosity
Description copied from interface:ChainedOptionsBuilder
Control verbosity level.- Specified by:
verbosity
in interfaceChainedOptionsBuilder
- Parameters:
mode
- flag- Returns:
- builder
- See Also:
-
verbosity
Description copied from interface:Options
How verbose should we be? -
shouldFailOnError
Description copied from interface:ChainedOptionsBuilder
Should fail on first benchmark error?- Specified by:
shouldFailOnError
in interfaceChainedOptionsBuilder
- Parameters:
value
- flag- Returns:
- builder
- See Also:
-
shouldFailOnError
Description copied from interface:Options
Should harness terminate on first error encountered?- Specified by:
shouldFailOnError
in interfaceOptions
- Returns:
- should terminate?
-
threads
Description copied from interface:ChainedOptionsBuilder
Number of threads to run the benchmark in- Specified by:
threads
in interfaceChainedOptionsBuilder
- Parameters:
count
- number of threads- Returns:
- builder
- See Also:
-
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:
-
threadGroups
Description copied from interface:ChainedOptionsBuilder
Subgroups thread distribution.- Specified by:
threadGroups
in interfaceChainedOptionsBuilder
- Parameters:
groups
- thread distribution- Returns:
- builder
- See Also:
-
getThreadGroups
Description copied from interface:Options
Thread subgroups distribution.- Specified by:
getThreadGroups
in interfaceOptions
- Returns:
- array of thread ratios
- See Also:
-
syncIterations
Description copied from interface:ChainedOptionsBuilder
Should synchronize measurementIterations?- Specified by:
syncIterations
in interfaceChainedOptionsBuilder
- Parameters:
value
- flag- Returns:
- builder
- See Also:
-
shouldSyncIterations
Description copied from interface:Options
Should synchronize iterations?- Specified by:
shouldSyncIterations
in interfaceOptions
- Returns:
- should we?
-
warmupIterations
Description copied from interface:ChainedOptionsBuilder
How many warmup iterations to do?- Specified by:
warmupIterations
in interfaceChainedOptionsBuilder
- Parameters:
value
- flag- Returns:
- builder
- See Also:
-
getWarmupIterations
Description copied from interface:Options
Number of warmup iterations- Specified by:
getWarmupIterations
in interfaceOptions
- Returns:
- number of warmup iterations
- See Also:
-
warmupBatchSize
Description copied from interface:ChainedOptionsBuilder
How large warmup batchSize should be?- Specified by:
warmupBatchSize
in interfaceChainedOptionsBuilder
- Parameters:
value
- batch size- Returns:
- builder
- See Also:
-
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:
-
warmupTime
Description copied from interface:ChainedOptionsBuilder
How long each warmup iteration should take?- Specified by:
warmupTime
in interfaceChainedOptionsBuilder
- Parameters:
value
- time- Returns:
- builder
- See Also:
-
getWarmupTime
Description copied from interface:Options
The duration for warmup iterations- Specified by:
getWarmupTime
in interfaceOptions
- Returns:
- duration
- See Also:
-
warmupMode
Description copied from interface:ChainedOptionsBuilder
Warmup mode to use- Specified by:
warmupMode
in interfaceChainedOptionsBuilder
- Parameters:
mode
- to use- Returns:
- builder
- See Also:
-
getWarmupMode
Description copied from interface:Options
Warmup mode.- Specified by:
getWarmupMode
in interfaceOptions
- Returns:
- warmup mode
- See Also:
-
includeWarmup
Description copied from interface:ChainedOptionsBuilder
What other benchmarks to warmup along the way- Specified by:
includeWarmup
in interfaceChainedOptionsBuilder
- Parameters:
regexp
- to match benchmarks against- Returns:
- builder
-
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
-
measurementIterations
Description copied from interface:ChainedOptionsBuilder
How many measurement measurementIterations to do- Specified by:
measurementIterations
in interfaceChainedOptionsBuilder
- Parameters:
count
- number of iterations- Returns:
- builder
- See Also:
-
getMeasurementIterations
Description copied from interface:Options
Number of measurement iterations- Specified by:
getMeasurementIterations
in interfaceOptions
- Returns:
- number of measurement iterations
- See Also:
-
measurementTime
Description copied from interface:ChainedOptionsBuilder
How long each measurement iteration should take?- Specified by:
measurementTime
in interfaceChainedOptionsBuilder
- Parameters:
value
- time- Returns:
- builder
- See Also:
-
getMeasurementTime
Description copied from interface:Options
The duration for measurement iterations- Specified by:
getMeasurementTime
in interfaceOptions
- Returns:
- duration
- See Also:
-
measurementBatchSize
Description copied from interface:ChainedOptionsBuilder
How large measurement batchSize should be?- Specified by:
measurementBatchSize
in interfaceChainedOptionsBuilder
- Parameters:
value
- batch size- Returns:
- builder
- See Also:
-
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:
-
mode
Description copied from interface:ChainedOptionsBuilder
Benchmark mode. (Can be used multiple times)- Specified by:
mode
in interfaceChainedOptionsBuilder
- Parameters:
mode
- benchmark mode- Returns:
- builder
- See Also:
-
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:
-
timeUnit
Description copied from interface:ChainedOptionsBuilder
Timeunit to use in results- Specified by:
timeUnit
in interfaceChainedOptionsBuilder
- Parameters:
tu
- time unit- Returns:
- builder
- See Also:
-
getTimeUnit
Description copied from interface:Options
Timeunit to use in units.- Specified by:
getTimeUnit
in interfaceOptions
- Returns:
- timeunit
- See Also:
-
operationsPerInvocation
Description copied from interface:ChainedOptionsBuilder
Operations per invocation.- Specified by:
operationsPerInvocation
in interfaceChainedOptionsBuilder
- Parameters:
opsPerInv
- operations per invocation.- Returns:
- builder
- See Also:
-
getOperationsPerInvocation
Description copied from interface:Options
Operations per invocation.- Specified by:
getOperationsPerInvocation
in interfaceOptions
- Returns:
- operations per invocation.
- See Also:
-
forks
Description copied from interface:ChainedOptionsBuilder
Number of forks to use in the run- Specified by:
forks
in interfaceChainedOptionsBuilder
- Parameters:
value
- number of forks- Returns:
- builder
- See Also:
-
getForkCount
Description copied from interface:Options
Fork count- Specified by:
getForkCount
in interfaceOptions
- Returns:
- fork count; 0, to prohibit forking
- See Also:
-
warmupForks
Description copied from interface:ChainedOptionsBuilder
Number of ignored forks- Specified by:
warmupForks
in interfaceChainedOptionsBuilder
- Parameters:
value
- number of ignored forks- Returns:
- builder
- See Also:
-
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:
-
jvm
Description copied from interface:ChainedOptionsBuilder
Forked JVM to use.- Specified by:
jvm
in interfaceChainedOptionsBuilder
- Parameters:
path
- path to /bin/java- Returns:
- builder
-
getJvm
Description copied from interface:Options
JVM executable to use for forks -
jvmArgs
Description copied from interface:ChainedOptionsBuilder
Forked JVM arguments.- Specified by:
jvmArgs
in interfaceChainedOptionsBuilder
- Parameters:
value
- arguments to add to the run- Returns:
- builder
- See Also:
-
getJvmArgs
Description copied from interface:Options
JVM parameters to use with forks- Specified by:
getJvmArgs
in interfaceOptions
- Returns:
- JVM parameters
- See Also:
-
jvmArgsAppend
Description copied from interface:ChainedOptionsBuilder
Append forked JVM arguments: These options go after other options.- Specified by:
jvmArgsAppend
in interfaceChainedOptionsBuilder
- Parameters:
value
- arguments to add to the run- Returns:
- builder
- See Also:
-
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:
-
jvmArgsPrepend
Description copied from interface:ChainedOptionsBuilder
Prepend forked JVM arguments: These options go before any other options.- Specified by:
jvmArgsPrepend
in interfaceChainedOptionsBuilder
- Parameters:
value
- arguments to add to the run- Returns:
- builder
- See Also:
-
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:
-
detectJvmArgs
Description copied from interface:ChainedOptionsBuilder
Autodetect forked JVM arguments from the parent VM. Overrides the jvmArgs(...) value.- Specified by:
detectJvmArgs
in interfaceChainedOptionsBuilder
- Returns:
- builder
-
getParameter
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
Description copied from interface:ChainedOptionsBuilder
Set benchmark parameter values. The parameter values would be taken in the order given by user.- Specified by:
param
in interfaceChainedOptionsBuilder
- Parameters:
name
- parametervalues
- sequence of values to set- Returns:
- builder
- See Also:
-
timeout
Description copied from interface:ChainedOptionsBuilder
How long to wait for iteration execution?- Specified by:
timeout
in interfaceChainedOptionsBuilder
- Parameters:
value
- time- Returns:
- builder
- See Also:
-
getTimeout
Description copied from interface:Options
Timeout: how long to wait for an iteration to complete.- Specified by:
getTimeout
in interfaceOptions
- Returns:
- duration
-