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:

  1. 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
  2. It can be injected into benchmark methods to access the runtime configuration info about the benchmark
See Also:
  • Field Details

    • 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 Details

  • Method Details

    • 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:
    • getThreadGroupLabels

      public Collection<String> getThreadGroupLabels()
      Returns:
      subgroup thread labels
      See Also:
    • 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 and java.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
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(BenchmarkParams o)
      Specified by:
      compareTo in interface Comparable<BenchmarkParams>
    • id

      public String id()