Skip to content

Commit b632dcc

Browse files
committed
Use dotted property form for JMH options (jmh.includes) and testJvm property for the JMH JVM
1 parent a6af161 commit b632dcc

3 files changed

Lines changed: 11 additions & 10 deletions

File tree

dd-trace-core/build.gradle

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import datadog.gradle.plugin.testJvmConstraints.TestJvmSpec
2+
13
plugins {
24
id 'me.champeau.jmh'
35
id 'dd-trace-java.version-file'
@@ -114,15 +116,14 @@ dependencies {
114116
jmh {
115117
jmhVersion = libs.versions.jmh.get()
116118
duplicateClassesStrategy = DuplicatesStrategy.EXCLUDE
117-
if (project.hasProperty('jmhIncludes')) {
118-
includes = [project.jmhIncludes]
119+
if (project.hasProperty('jmh.includes')) {
120+
includes = [project.property('jmh.includes').replace(',', '|')]
119121
}
120-
if (project.hasProperty('jmhProfilers')) {
121-
profilers = [project.jmhProfilers]
122+
if (project.hasProperty('jmh.profilers')) {
123+
profilers = project.property('jmh.profilers').tokenize(',')
122124
}
123-
if (project.hasProperty('jmhJvm')) {
124-
jvm = project.javaToolchains.launcherFor {
125-
languageVersion = JavaLanguageVersion.of(project.jmhJvm as int)
126-
}.map { it.executablePath.asFile.absolutePath }
125+
if (project.hasProperty('testJvm')) {
126+
def testJvmSpec = new TestJvmSpec(project)
127+
jvm = testJvmSpec.javaTestLauncher.map { it.executablePath.asFile.absolutePath }
127128
}
128129
}

dd-trace-core/src/jmh/java/datadog/context/ContextManagerBenchmark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* <p>Run with:
3535
*
3636
* <pre>
37-
* {@code ./gradlew :dd-trace-core:jmh -PjmhIncludes=ContextManagerBenchmark -PjmhJvm=25 -PjmhProfilers=gc}
37+
* {@code ./gradlew :dd-trace-core:jmh -Pjmh.includes=ContextManagerBenchmark -PtestJvm=25 -Pjmh.profilers=gc}
3838
* </pre>
3939
*/
4040
@State(Scope.Benchmark)

dd-trace-core/src/jmh/java/datadog/context/ContextManagerDepthBenchmark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* <p>Run with:
2929
*
3030
* <pre>
31-
* {@code ./gradlew :dd-trace-core:jmh -PjmhIncludes=ContextManagerDepthBenchmark -PjmhJvm=25 -PjmhProfilers=gc}
31+
* {@code ./gradlew :dd-trace-core:jmh -Pjmh.includes=ContextManagerDepthBenchmark -PtestJvm=25 -Pjmh.profilers=gc}
3232
* </pre>
3333
*/
3434
@State(Scope.Benchmark)

0 commit comments

Comments
 (0)