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();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for BenchmarkConfiguration. -
Constructor Summary
ConstructorsConstructorDescriptionBenchmarkConfiguration(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 aBenchmarkConfigurationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionConvenience methods for accessing nested report configuration.builder()Creates a configuration builder with system properties for JMH settings.defaults()Creates a default configuration.final booleanIndicates whether some other object is "equal to" this one.intforks()Returns the value of theforksrecord component.final inthashCode()Returns a hash code value for this object.booleanChecks if this configuration includes integration configuration.Returns the value of theincludePatternrecord component.Returns the value of theintegrationConfigrecord component.intReturns the value of themeasurementIterationsrecord component.org.openjdk.jmh.runner.options.TimeValueReturns the value of themeasurementTimerecord component.Returns the value of thereportConfigrecord component.intthreads()Returns the value of thethreadsrecord component.Creates a builder from this configuration.final StringtoString()Returns a string representation of this record class.intReturns the value of thewarmupIterationsrecord component.org.openjdk.jmh.runner.options.TimeValueReturns the value of thewarmupTimerecord component.
-
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 aBenchmarkConfigurationrecord class.- Parameters:
reportConfig- the value for thereportConfigrecord componentincludePattern- the value for theincludePatternrecord componentforks- the value for theforksrecord componentwarmupIterations- the value for thewarmupIterationsrecord componentmeasurementIterations- the value for themeasurementIterationsrecord componentmeasurementTime- the value for themeasurementTimerecord componentwarmupTime- the value for thewarmupTimerecord componentthreads- the value for thethreadsrecord componentintegrationConfig- the value for theintegrationConfigrecord 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
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
-
projectName
-
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. -
hashCode
Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
reportConfig
Returns the value of thereportConfigrecord component.- Returns:
- the value of the
reportConfigrecord component
-
includePattern
Returns the value of theincludePatternrecord component.- Returns:
- the value of the
includePatternrecord component
-
forks
Returns the value of theforksrecord component.- Returns:
- the value of the
forksrecord component
-
warmupIterations
Returns the value of thewarmupIterationsrecord component.- Returns:
- the value of the
warmupIterationsrecord component
-
measurementIterations
Returns the value of themeasurementIterationsrecord component.- Returns:
- the value of the
measurementIterationsrecord component
-
measurementTime
Returns the value of themeasurementTimerecord component.- Returns:
- the value of the
measurementTimerecord component
-
warmupTime
Returns the value of thewarmupTimerecord component.- Returns:
- the value of the
warmupTimerecord component
-
threads
Returns the value of thethreadsrecord component.- Returns:
- the value of the
threadsrecord component
-
integrationConfig
Returns the value of theintegrationConfigrecord component.- Returns:
- the value of the
integrationConfigrecord component
-