Class 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:
    Serialized Form
    • 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
      • forks

        protected final int forks
      • warmupForks

        protected final int warmupForks
      • mode

        protected final Mode mode
      • timeUnit

        protected final TimeUnit timeUnit
      • opsPerInvocation

        protected final int opsPerInvocation
      • jvm

        protected final String jvm
      • jdkVersion

        protected final String jdkVersion
      • jmhVersion

        protected final String jmhVersion
      • vmName

        protected final String vmName
      • vmVersion

        protected final String vmVersion
    • 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
      • 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.
      • 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
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object