public class OptionsBuilder extends Object implements Options, ChainedOptionsBuilder
Constructor and Description |
---|
OptionsBuilder() |
Modifier and Type | Method and Description |
---|---|
ChainedOptionsBuilder |
addProfiler(Class<? extends Profiler> prof)
Add the profiler in the run
|
ChainedOptionsBuilder |
addProfiler(Class<? extends Profiler> prof,
String initLine)
Add the profiler in the run
|
ChainedOptionsBuilder |
addProfiler(String prof)
Add the profiler in the run
|
ChainedOptionsBuilder |
addProfiler(String prof,
String initLine)
Add the profiler in the run
|
Options |
build()
Produce the final Options
|
ChainedOptionsBuilder |
detectJvmArgs()
Autodetect forked JVM arguments from the parent VM.
|
ChainedOptionsBuilder |
exclude(String regexp)
Exclude benchmarks from the run
(Can be used multiple times)
|
ChainedOptionsBuilder |
forks(int value)
Number of forks to use in the run
|
Collection<Mode> |
getBenchModes()
Benchmarks modes to execute.
|
List<String> |
getExcludes()
Which benchmarks to omit?
|
Optional<Integer> |
getForkCount()
Fork count
|
List<String> |
getIncludes()
Which benchmarks to execute?
|
Optional<String> |
getJvm()
JVM executable to use for forks
|
Optional<Collection<String>> |
getJvmArgs()
JVM parameters to use with forks
|
Optional<Collection<String>> |
getJvmArgsAppend()
JVM parameters to use with forks (these options will be appended
after any other JVM option)
|
Optional<Collection<String>> |
getJvmArgsPrepend()
JVM parameters to use with forks (these options will be prepended
before any other JVM option)
|
Optional<Integer> |
getMeasurementBatchSize()
Number of batch size for measurement
|
Optional<Integer> |
getMeasurementIterations()
Number of measurement iterations
|
Optional<TimeValue> |
getMeasurementTime()
The duration for measurement iterations
|
Optional<Integer> |
getOperationsPerInvocation()
Operations per invocation.
|
Optional<String> |
getOutput()
Which file to use for dumping the output
|
Optional<Collection<String>> |
getParameter(String name)
The overridden value of the parameter.
|
List<ProfilerConfig> |
getProfilers()
Profilers to use for the run.
|
Optional<String> |
getResult()
Which file to use for dumping the result
|
Optional<ResultFormatType> |
getResultFormat()
Result format to use
|
Optional<int[]> |
getThreadGroups()
Thread subgroups distribution.
|
Optional<Integer> |
getThreads()
Number of threads to run
|
Optional<TimeValue> |
getTimeout()
Timeout: how long to wait for an iteration to complete.
|
Optional<TimeUnit> |
getTimeUnit()
Timeunit to use in units.
|
Optional<Integer> |
getWarmupBatchSize()
Number of batch size for warmup
|
Optional<Integer> |
getWarmupForkCount()
Number of initial forks to ignore the results for
|
List<String> |
getWarmupIncludes()
Which benchmarks to warmup before doing the run.
|
Optional<Integer> |
getWarmupIterations()
Number of warmup iterations
|
Optional<WarmupMode> |
getWarmupMode()
Warmup mode.
|
Optional<TimeValue> |
getWarmupTime()
The duration for warmup iterations
|
ChainedOptionsBuilder |
include(String regexp)
Include benchmark in the run
(Can be used multiple times)
|
ChainedOptionsBuilder |
includeWarmup(String regexp)
What other benchmarks to warmup along the way
|
ChainedOptionsBuilder |
jvm(String path)
Forked JVM to use.
|
ChainedOptionsBuilder |
jvmArgs(String... value)
Forked JVM arguments.
|
ChainedOptionsBuilder |
jvmArgsAppend(String... value)
Append forked JVM arguments:
These options go after other options.
|
ChainedOptionsBuilder |
jvmArgsPrepend(String... value)
Prepend forked JVM arguments:
These options go before any other options.
|
ChainedOptionsBuilder |
measurementBatchSize(int value)
How large measurement batchSize should be?
|
ChainedOptionsBuilder |
measurementIterations(int count)
How many measurement measurementIterations to do
|
ChainedOptionsBuilder |
measurementTime(TimeValue value)
How long each measurement iteration should take?
|
ChainedOptionsBuilder |
mode(Mode mode)
Benchmark mode.
|
ChainedOptionsBuilder |
operationsPerInvocation(int opsPerInv)
Operations per invocation.
|
ChainedOptionsBuilder |
output(String filename)
Output filename to write the run log to
|
ChainedOptionsBuilder |
param(String name,
String... values)
Set benchmark parameter values.
|
ChainedOptionsBuilder |
parent(Options other)
Override the defaults from the given option.
|
ChainedOptionsBuilder |
result(String filename)
Output filename to write the result to
|
ChainedOptionsBuilder |
resultFormat(ResultFormatType type)
ResultFormatType to use in the run
|
Optional<Boolean> |
shouldDoGC()
Should force GC between iterations?
|
ChainedOptionsBuilder |
shouldDoGC(boolean value)
Should do GC between measurementIterations?
|
Optional<Boolean> |
shouldFailOnError()
Should harness terminate on first error encountered?
|
ChainedOptionsBuilder |
shouldFailOnError(boolean value)
Should fail on first benchmark error?
|
Optional<Boolean> |
shouldSyncIterations()
Should synchronize iterations?
|
ChainedOptionsBuilder |
syncIterations(boolean value)
Should synchronize measurementIterations?
|
ChainedOptionsBuilder |
threadGroups(int... groups)
Subgroups thread distribution.
|
ChainedOptionsBuilder |
threads(int count)
Number of threads to run the benchmark in
|
ChainedOptionsBuilder |
timeout(TimeValue value)
How long to wait for iteration execution?
|
ChainedOptionsBuilder |
timeUnit(TimeUnit tu)
Timeunit to use in results
|
Optional<VerboseMode> |
verbosity()
How verbose should we be?
|
ChainedOptionsBuilder |
verbosity(VerboseMode mode)
Control verbosity level.
|
ChainedOptionsBuilder |
warmupBatchSize(int value)
How large warmup batchSize should be?
|
ChainedOptionsBuilder |
warmupForks(int value)
Number of ignored forks
|
ChainedOptionsBuilder |
warmupIterations(int value)
How many warmup iterations to do?
|
ChainedOptionsBuilder |
warmupMode(WarmupMode mode)
Warmup mode to use
|
ChainedOptionsBuilder |
warmupTime(TimeValue value)
How long each warmup iteration should take?
|
public Options build()
ChainedOptionsBuilder
build
in interface ChainedOptionsBuilder
public ChainedOptionsBuilder parent(Options other)
ChainedOptionsBuilder
parent
in interface ChainedOptionsBuilder
other
- options to base onpublic ChainedOptionsBuilder include(String regexp)
ChainedOptionsBuilder
include
in interface ChainedOptionsBuilder
regexp
- to match benchmarks againstDefaults.INCLUDE_BENCHMARKS
public List<String> getIncludes()
Options
getIncludes
in interface Options
public ChainedOptionsBuilder exclude(String regexp)
ChainedOptionsBuilder
exclude
in interface ChainedOptionsBuilder
regexp
- to match benchmark againstpublic List<String> getExcludes()
Options
getExcludes
in interface Options
public ChainedOptionsBuilder output(String filename)
ChainedOptionsBuilder
output
in interface ChainedOptionsBuilder
filename
- file namepublic Optional<String> getOutput()
Options
public ChainedOptionsBuilder resultFormat(ResultFormatType type)
ChainedOptionsBuilder
resultFormat
in interface ChainedOptionsBuilder
type
- resultformat typeDefaults.RESULT_FORMAT
public Optional<ResultFormatType> getResultFormat()
Options
getResultFormat
in interface Options
public ChainedOptionsBuilder result(String filename)
ChainedOptionsBuilder
result
in interface ChainedOptionsBuilder
filename
- file nameDefaults.RESULT_FILE_PREFIX
public Optional<String> getResult()
Options
public ChainedOptionsBuilder shouldDoGC(boolean value)
ChainedOptionsBuilder
shouldDoGC
in interface ChainedOptionsBuilder
value
- flagDefaults.DO_GC
public Optional<Boolean> shouldDoGC()
Options
shouldDoGC
in interface Options
public ChainedOptionsBuilder addProfiler(Class<? extends Profiler> prof)
ChainedOptionsBuilder
addProfiler
in interface ChainedOptionsBuilder
prof
- profiler classpublic ChainedOptionsBuilder addProfiler(Class<? extends Profiler> prof, String initLine)
ChainedOptionsBuilder
addProfiler
in interface ChainedOptionsBuilder
prof
- profiler classinitLine
- profiler options initialization linepublic ChainedOptionsBuilder addProfiler(String prof)
ChainedOptionsBuilder
addProfiler
in interface ChainedOptionsBuilder
prof
- profiler class name, or profiler aliaspublic ChainedOptionsBuilder addProfiler(String prof, String initLine)
ChainedOptionsBuilder
addProfiler
in interface ChainedOptionsBuilder
prof
- profiler class name, or profiler aliasinitLine
- profiler options initialization linepublic List<ProfilerConfig> getProfilers()
Options
getProfilers
in interface Options
public ChainedOptionsBuilder verbosity(VerboseMode mode)
ChainedOptionsBuilder
verbosity
in interface ChainedOptionsBuilder
mode
- flagDefaults.VERBOSITY
public Optional<VerboseMode> verbosity()
Options
public ChainedOptionsBuilder shouldFailOnError(boolean value)
ChainedOptionsBuilder
shouldFailOnError
in interface ChainedOptionsBuilder
value
- flagDefaults.FAIL_ON_ERROR
public Optional<Boolean> shouldFailOnError()
Options
shouldFailOnError
in interface Options
public ChainedOptionsBuilder threads(int count)
ChainedOptionsBuilder
threads
in interface ChainedOptionsBuilder
count
- number of threadsThreads
,
Defaults.THREADS
public Optional<Integer> getThreads()
Options
getThreads
in interface Options
Threads
public ChainedOptionsBuilder threadGroups(int... groups)
ChainedOptionsBuilder
threadGroups
in interface ChainedOptionsBuilder
groups
- thread distributionGroup
,
GroupThreads
public Optional<int[]> getThreadGroups()
Options
getThreadGroups
in interface Options
Group
,
GroupThreads
public ChainedOptionsBuilder syncIterations(boolean value)
ChainedOptionsBuilder
syncIterations
in interface ChainedOptionsBuilder
value
- flagDefaults.SYNC_ITERATIONS
public Optional<Boolean> shouldSyncIterations()
Options
shouldSyncIterations
in interface Options
public ChainedOptionsBuilder warmupIterations(int value)
ChainedOptionsBuilder
warmupIterations
in interface ChainedOptionsBuilder
value
- flagWarmup
,
Defaults.WARMUP_ITERATIONS
,
Defaults.WARMUP_ITERATIONS_SINGLESHOT
public Optional<Integer> getWarmupIterations()
Options
getWarmupIterations
in interface Options
Warmup
public ChainedOptionsBuilder warmupBatchSize(int value)
ChainedOptionsBuilder
warmupBatchSize
in interface ChainedOptionsBuilder
value
- batch sizeWarmup
,
Defaults.WARMUP_BATCHSIZE
public Optional<Integer> getWarmupBatchSize()
Options
getWarmupBatchSize
in interface Options
Warmup
public ChainedOptionsBuilder warmupTime(TimeValue value)
ChainedOptionsBuilder
warmupTime
in interface ChainedOptionsBuilder
value
- timeWarmup
,
Defaults.WARMUP_TIME
public Optional<TimeValue> getWarmupTime()
Options
getWarmupTime
in interface Options
Warmup
public ChainedOptionsBuilder warmupMode(WarmupMode mode)
ChainedOptionsBuilder
warmupMode
in interface ChainedOptionsBuilder
mode
- to useDefaults.WARMUP_MODE
public Optional<WarmupMode> getWarmupMode()
Options
getWarmupMode
in interface Options
WarmupMode
public ChainedOptionsBuilder includeWarmup(String regexp)
ChainedOptionsBuilder
includeWarmup
in interface ChainedOptionsBuilder
regexp
- to match benchmarks againstpublic List<String> getWarmupIncludes()
Options
getWarmupIncludes
in interface Options
public ChainedOptionsBuilder measurementIterations(int count)
ChainedOptionsBuilder
measurementIterations
in interface ChainedOptionsBuilder
count
- number of iterationsMeasurement
,
Defaults.MEASUREMENT_ITERATIONS
,
Defaults.MEASUREMENT_ITERATIONS_SINGLESHOT
public Optional<Integer> getMeasurementIterations()
Options
getMeasurementIterations
in interface Options
Measurement
public ChainedOptionsBuilder measurementTime(TimeValue value)
ChainedOptionsBuilder
measurementTime
in interface ChainedOptionsBuilder
value
- timeMeasurement
,
Defaults.MEASUREMENT_TIME
public Optional<TimeValue> getMeasurementTime()
Options
getMeasurementTime
in interface Options
Measurement
public ChainedOptionsBuilder measurementBatchSize(int value)
ChainedOptionsBuilder
measurementBatchSize
in interface ChainedOptionsBuilder
value
- batch sizeMeasurement
,
Defaults.MEASUREMENT_BATCHSIZE
public Optional<Integer> getMeasurementBatchSize()
Options
getMeasurementBatchSize
in interface Options
Measurement
public ChainedOptionsBuilder mode(Mode mode)
ChainedOptionsBuilder
mode
in interface ChainedOptionsBuilder
mode
- benchmark modeBenchmarkMode
,
Defaults.BENCHMARK_MODE
public Collection<Mode> getBenchModes()
Options
getBenchModes
in interface Options
BenchmarkMode
public ChainedOptionsBuilder timeUnit(TimeUnit tu)
ChainedOptionsBuilder
timeUnit
in interface ChainedOptionsBuilder
tu
- time unitOutputTimeUnit
,
Defaults.OUTPUT_TIMEUNIT
public Optional<TimeUnit> getTimeUnit()
Options
getTimeUnit
in interface Options
OutputTimeUnit
public ChainedOptionsBuilder operationsPerInvocation(int opsPerInv)
ChainedOptionsBuilder
operationsPerInvocation
in interface ChainedOptionsBuilder
opsPerInv
- operations per invocation.OperationsPerInvocation
,
Defaults.OPS_PER_INVOCATION
public Optional<Integer> getOperationsPerInvocation()
Options
getOperationsPerInvocation
in interface Options
OperationsPerInvocation
public ChainedOptionsBuilder forks(int value)
ChainedOptionsBuilder
forks
in interface ChainedOptionsBuilder
value
- number of forksFork
,
Defaults.MEASUREMENT_FORKS
public Optional<Integer> getForkCount()
Options
getForkCount
in interface Options
Fork
public ChainedOptionsBuilder warmupForks(int value)
ChainedOptionsBuilder
warmupForks
in interface ChainedOptionsBuilder
value
- number of ignored forksFork
,
Defaults.WARMUP_FORKS
public Optional<Integer> getWarmupForkCount()
Options
getWarmupForkCount
in interface Options
Fork
public ChainedOptionsBuilder jvm(String path)
ChainedOptionsBuilder
jvm
in interface ChainedOptionsBuilder
path
- path to /bin/javapublic Optional<String> getJvm()
Options
public ChainedOptionsBuilder jvmArgs(String... value)
ChainedOptionsBuilder
jvmArgs
in interface ChainedOptionsBuilder
value
- arguments to add to the runFork
public Optional<Collection<String>> getJvmArgs()
Options
getJvmArgs
in interface Options
Fork
public ChainedOptionsBuilder jvmArgsAppend(String... value)
ChainedOptionsBuilder
jvmArgsAppend
in interface ChainedOptionsBuilder
value
- arguments to add to the runFork
public Optional<Collection<String>> getJvmArgsAppend()
Options
getJvmArgsAppend
in interface Options
Fork
public ChainedOptionsBuilder jvmArgsPrepend(String... value)
ChainedOptionsBuilder
jvmArgsPrepend
in interface ChainedOptionsBuilder
value
- arguments to add to the runFork
public Optional<Collection<String>> getJvmArgsPrepend()
Options
getJvmArgsPrepend
in interface Options
Fork
public ChainedOptionsBuilder detectJvmArgs()
ChainedOptionsBuilder
detectJvmArgs
in interface ChainedOptionsBuilder
public Optional<Collection<String>> getParameter(String name)
Options
getParameter
in interface Options
name
- parameter nameParam
public ChainedOptionsBuilder param(String name, String... values)
ChainedOptionsBuilder
param
in interface ChainedOptionsBuilder
name
- parametervalues
- sequence of values to setParam
public ChainedOptionsBuilder timeout(TimeValue value)
ChainedOptionsBuilder
timeout
in interface ChainedOptionsBuilder
value
- timeDefaults.TIMEOUT
public Optional<TimeValue> getTimeout()
Options
getTimeout
in interface Options
Copyright © 2012–2020 Oracle. All rights reserved.