Package org.openjdk.jmh.infra
Class BenchmarkParams
- java.lang.Object
-
- org.openjdk.jmh.infra.BenchmarkParams
-
- All Implemented Interfaces:
Serializable,Comparable<BenchmarkParams>
public class BenchmarkParams extends Object
Benchmark parameters.BenchmarkParamshandles the parameters used in the current run.This class is dual-purpose:
- It acts as the interface between host JVM and forked JVM, so that the latter would not have to figure out the benchmark configuration again
- It can be injected into benchmark methods to access the runtime configuration info about the benchmark
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Stringbenchmarkprotected intforksprotected StringgeneratedTargetprotected StringjdkVersionprotected StringjmhVersionprotected Stringjvmprotected Collection<String>jvmArgsprotected IterationParamsmeasurementprotected Modemodeprotected intopsPerInvocationprotected WorkloadParamsparamsprotected booleansynchIterationsprotected Collection<String>threadGroupLabelsprotected int[]threadGroupsprotected intthreadsprotected TimeValuetimeoutprotected TimeUnittimeUnitprotected StringvmNameprotected StringvmVersionprotected IterationParamswarmupprotected intwarmupForks
-
Constructor Summary
Constructors Constructor Description BenchmarkParams(String benchmark, String generatedTarget, boolean synchIterations, int threads, int[] threadGroups, Collection<String> threadGroupLabels, int forks, int warmupForks, IterationParams warmup, IterationParams measurement, Mode mode, WorkloadParams params, TimeUnit timeUnit, int opsPerInvocation, String jvm, Collection<String> jvmArgs, String jdkVersion, String vmName, String vmVersion, String jmhVersion, TimeValue timeout)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(BenchmarkParams o)booleanequals(Object o)StringgeneratedBenchmark()StringgetBenchmark()intgetForks()StringgetJdkVersion()StringgetJmhVersion()StringgetJvm()Collection<String>getJvmArgs()IterationParamsgetMeasurement()ModegetMode()intgetOpsPerInvocation()StringgetParam(String key)Collection<String>getParamsKeys()Collection<String>getThreadGroupLabels()int[]getThreadGroups()intgetThreads()TimeValuegetTimeout()TimeUnitgetTimeUnit()StringgetVmName()StringgetVmVersion()IterationParamsgetWarmup()intgetWarmupForks()inthashCode()Stringid()booleanshouldSynchIterations()
-
-
-
Field Detail
-
benchmark
protected final String benchmark
-
generatedTarget
protected final String generatedTarget
-
synchIterations
protected final boolean synchIterations
-
threads
protected final int threads
-
threadGroups
protected final int[] threadGroups
-
threadGroupLabels
protected final Collection<String> threadGroupLabels
-
forks
protected final int forks
-
warmupForks
protected final int warmupForks
-
warmup
protected final IterationParams warmup
-
measurement
protected final IterationParams measurement
-
mode
protected final Mode mode
-
params
protected final WorkloadParams params
-
timeUnit
protected final TimeUnit timeUnit
-
opsPerInvocation
protected final int opsPerInvocation
-
jvm
protected final String jvm
-
jvmArgs
protected final Collection<String> jvmArgs
-
jdkVersion
protected final String jdkVersion
-
jmhVersion
protected final String jmhVersion
-
vmName
protected final String vmName
-
vmVersion
protected final String vmVersion
-
timeout
protected final TimeValue timeout
-
-
Constructor Detail
-
BenchmarkParams
public BenchmarkParams(String benchmark, String generatedTarget, boolean synchIterations, int threads, int[] threadGroups, Collection<String> threadGroupLabels, int forks, int warmupForks, IterationParams warmup, IterationParams measurement, Mode mode, WorkloadParams params, TimeUnit timeUnit, int opsPerInvocation, String jvm, Collection<String> jvmArgs, String jdkVersion, String vmName, String vmVersion, String jmhVersion, TimeValue timeout)
-
-
Method Detail
-
getTimeout
public TimeValue getTimeout()
- Returns:
- how long to wait for iteration to complete
-
shouldSynchIterations
public boolean shouldSynchIterations()
- Returns:
- do we synchronize iterations?
-
getWarmup
public IterationParams getWarmup()
- Returns:
- iteration parameters for warmup phase
-
getMeasurement
public IterationParams getMeasurement()
- Returns:
- iteration parameters for measurement phase
-
getThreads
public int getThreads()
- Returns:
- total measurement thread count
-
getThreadGroups
public int[] getThreadGroups()
- Returns:
- thread distribution within the group
- See Also:
ChainedOptionsBuilder.threadGroups(int...)
-
getThreadGroupLabels
public Collection<String> getThreadGroupLabels()
- Returns:
- subgroup thread labels
- See Also:
getThreadGroups()
-
getForks
public int getForks()
- Returns:
- number of forked VM runs, which we measure
-
getWarmupForks
public int getWarmupForks()
- Returns:
- number of forked VM runs, which we discard from the result
-
getMode
public Mode getMode()
- Returns:
- benchmark mode
-
getBenchmark
public String getBenchmark()
- Returns:
- benchmark name
-
getTimeUnit
public TimeUnit getTimeUnit()
- Returns:
- timeUnit used in results
-
getOpsPerInvocation
public int getOpsPerInvocation()
- Returns:
- operations per invocation used
-
getParamsKeys
public Collection<String> getParamsKeys()
- Returns:
- all workload parameters
-
getParam
public String getParam(String key)
- Parameters:
key- parameter key; usually the field name- Returns:
- parameter value for given key
-
generatedBenchmark
public String generatedBenchmark()
- Returns:
- generated benchmark name
-
getJvm
public String getJvm()
- Returns:
- JVM executable path
-
getJmhVersion
public String getJmhVersion()
- Returns:
- JMH version identical to
Version.getPlainVersion(), but output format should get there input via bean for testing purposes.
-
getJvmArgs
public Collection<String> getJvmArgs()
- Returns:
- JVM options
-
getJdkVersion
public String getJdkVersion()
- Returns:
- version information as returned by the effective target JVM,
via system property
java.versionandjava.vm.version
-
getVmVersion
public String getVmVersion()
- Returns:
- version information as returned by the effective target JVM,
via system property
java.vm.version
-
getVmName
public String getVmName()
- Returns:
- name information as returned by the effective target JVM,
via system property
java.vm.name
-
compareTo
public int compareTo(BenchmarkParams o)
- Specified by:
compareToin interfaceComparable<BenchmarkParams>
-
id
public String id()
-
-