diff --git a/buildSrc/src/main/kotlin/otel.jmh-conventions.gradle.kts b/buildSrc/src/main/kotlin/otel.jmh-conventions.gradle.kts index 70b661afabe..e7886e60684 100644 --- a/buildSrc/src/main/kotlin/otel.jmh-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/otel.jmh-conventions.gradle.kts @@ -28,6 +28,31 @@ jmh { includes.add(jmhIncludeSingleClass as String) } + val jmhFork: String? by project + if (jmhFork != null) { + fork.set(jmhFork!!.toInt()) + } + + val jmhIterations: String? by project + if (jmhIterations != null) { + iterations.set(jmhIterations!!.toInt()) + } + + val jmhTime: String? by project + if (jmhTime != null) { + timeOnIteration.set(jmhTime) + } + + val jmhWarmupIterations: String? by project + if (jmhWarmupIterations != null) { + warmupIterations.set(jmhWarmupIterations!!.toInt()) + } + + val jmhWarmup: String? by project + if (jmhWarmup != null) { + warmup.set(jmhWarmup) + } + val testJavaVersion = gradle.startParameter.projectProperties.get("testJavaVersion")?.let(JavaVersion::toVersion) if (testJavaVersion != null) { val javaExecutable = javaToolchains.launcherFor { diff --git a/docs/knowledge/other-tasks.md b/docs/knowledge/other-tasks.md index 7a5b540120d..bb886d600a9 100644 --- a/docs/knowledge/other-tasks.md +++ b/docs/knowledge/other-tasks.md @@ -13,6 +13,17 @@ Benchmark sources live in `jmh/` directories within their respective modules. ./gradlew -PjmhIncludeSingleClass=BatchSpanProcessorBenchmark :sdk:trace:jmh ``` +The following JMH parameters can be configured via `-P` flags: + +| Flag | JMH setting | Example | +|---|---|---| +| `-PjmhIncludeSingleClass=` | Run only this benchmark class | `-PjmhIncludeSingleClass=BatchSpanProcessorBenchmark` | +| `-PjmhFork=` | Number of forks | `-PjmhFork=1` | +| `-PjmhIterations=` | Measurement iterations | `-PjmhIterations=5` | +| `-PjmhTime=` | Time per measurement iteration | `-PjmhTime=2s` | +| `-PjmhWarmupIterations=` | Warmup iterations | `-PjmhWarmupIterations=3` | +| `-PjmhWarmup=` | Time per warmup iteration | `-PjmhWarmup=1s` | + ## Composite builds > **No compatibility guarantees**: this process can change at any time. Steps that work for one