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.BenchmarkParams
handles 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 String
benchmark
protected int
forks
protected String
generatedTarget
protected String
jdkVersion
protected String
jmhVersion
protected String
jvm
protected Collection<String>
jvmArgs
protected IterationParams
measurement
protected Mode
mode
protected int
opsPerInvocation
protected WorkloadParams
params
protected boolean
synchIterations
protected Collection<String>
threadGroupLabels
protected int[]
threadGroups
protected int
threads
protected TimeValue
timeout
protected TimeUnit
timeUnit
protected String
vmName
protected String
vmVersion
protected IterationParams
warmup
protected int
warmupForks
-
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 int
compareTo(BenchmarkParams o)
boolean
equals(Object o)
String
generatedBenchmark()
String
getBenchmark()
int
getForks()
String
getJdkVersion()
String
getJmhVersion()
String
getJvm()
Collection<String>
getJvmArgs()
IterationParams
getMeasurement()
Mode
getMode()
int
getOpsPerInvocation()
String
getParam(String key)
Collection<String>
getParamsKeys()
Collection<String>
getThreadGroupLabels()
int[]
getThreadGroups()
int
getThreads()
TimeValue
getTimeout()
TimeUnit
getTimeUnit()
String
getVmName()
String
getVmVersion()
IterationParams
getWarmup()
int
getWarmupForks()
int
hashCode()
String
id()
boolean
shouldSynchIterations()
-
-
-
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.version
andjava.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:
compareTo
in interfaceComparable<BenchmarkParams>
-
id
public String id()
-
-