Record Class BenchmarkConfiguration

java.lang.Object
java.lang.Record
de.cuioss.benchmarking.common.config.BenchmarkConfiguration

public record BenchmarkConfiguration(ReportConfiguration reportConfig, String includePattern, int forks, int warmupIterations, int measurementIterations, org.openjdk.jmh.runner.options.TimeValue measurementTime, org.openjdk.jmh.runner.options.TimeValue warmupTime, int threads, IntegrationConfiguration integrationConfig) extends Record
Modern configuration API for JMH benchmarks. Provides a fluent builder pattern and immutable configuration objects. Combines JMH runtime configuration with report generation configuration.

Example usage:


 var config = BenchmarkConfiguration.builder()
     .withReportConfig(ReportConfiguration.builder()
         .withBenchmarkType(BenchmarkType.MICRO)
         .withThroughputBenchmarkName("myThroughputTest")
         .withLatencyBenchmarkName("myLatencyTest")
         .build())
     .withForks(2)
     .withThreads(10)
     .build();
 
 Options jmhOptions = config.toJmhOptions();
 
  • Constructor Details

    • BenchmarkConfiguration

      public BenchmarkConfiguration(ReportConfiguration reportConfig, String includePattern, int forks, int warmupIterations, int measurementIterations, org.openjdk.jmh.runner.options.TimeValue measurementTime, org.openjdk.jmh.runner.options.TimeValue warmupTime, int threads, IntegrationConfiguration integrationConfig)
      Creates an instance of a BenchmarkConfiguration record class.
      Parameters:
      reportConfig - the value for the reportConfig record component
      includePattern - the value for the includePattern record component
      forks - the value for the forks record component
      warmupIterations - the value for the warmupIterations record component
      measurementIterations - the value for the measurementIterations record component
      measurementTime - the value for the measurementTime record component
      warmupTime - the value for the warmupTime record component
      threads - the value for the threads record component
      integrationConfig - the value for the integrationConfig record component
  • Method Details

    • builder

      Creates a configuration builder with system properties for JMH settings. Note: Report configuration must be set explicitly via the builder.
      Returns:
      a new builder initialized from system properties
    • defaults

      Creates a default configuration.
      Returns:
      a new builder with default values
    • toBuilder

      Creates a builder from this configuration.
      Returns:
      a new builder initialized with this configuration's values
    • hasIntegrationConfig

      public boolean hasIntegrationConfig()
      Checks if this configuration includes integration configuration. Integration configuration is required for integration benchmarks.
      Returns:
      true if integration configuration is present, false otherwise
    • benchmarkType

      Convenience methods for accessing nested report configuration.
    • throughputBenchmarkName

    • latencyBenchmarkName

    • resultsDirectory

    • resultFile

      public String resultFile()
    • projectName

      public String projectName()
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • reportConfig

      Returns the value of the reportConfig record component.
      Returns:
      the value of the reportConfig record component
    • includePattern

      Returns the value of the includePattern record component.
      Returns:
      the value of the includePattern record component
    • forks

      public int forks()
      Returns the value of the forks record component.
      Returns:
      the value of the forks record component
    • warmupIterations

      public int warmupIterations()
      Returns the value of the warmupIterations record component.
      Returns:
      the value of the warmupIterations record component
    • measurementIterations

      public int measurementIterations()
      Returns the value of the measurementIterations record component.
      Returns:
      the value of the measurementIterations record component
    • measurementTime

      public org.openjdk.jmh.runner.options.TimeValue measurementTime()
      Returns the value of the measurementTime record component.
      Returns:
      the value of the measurementTime record component
    • warmupTime

      public org.openjdk.jmh.runner.options.TimeValue warmupTime()
      Returns the value of the warmupTime record component.
      Returns:
      the value of the warmupTime record component
    • threads

      public int threads()
      Returns the value of the threads record component.
      Returns:
      the value of the threads record component
    • integrationConfig

      Returns the value of the integrationConfig record component.
      Returns:
      the value of the integrationConfig record component