Skip to content

Commit

Permalink
Add support for passing in benchmark parameters to JMH benchmarks.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukecwik committed Feb 17, 2023
1 parent 6de6744 commit 208763d
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1522,7 +1522,7 @@ class BeamModulePlugin implements Plugin<Project> {
}
}

project.tasks.register("jmh", JavaExec) {
project.tasks.register("jmh", JavaExec) {
dependsOn project.classes
// Note: this will wrap the default JMH runner publishing results to InfluxDB
mainClass = "org.apache.beam.sdk.testutils.jmh.Main"
Expand Down Expand Up @@ -1558,6 +1558,17 @@ class BeamModulePlugin implements Plugin<Project> {
// that ends up on the runtime classpath.
args 'org.apache.beam'
}

// Benchmark parameters. Parameters should be separated by |.
// Parameter name and parameter values should be separated with equals
// sign. Parameter values should be separated with commas.
//
// For example:
// -PbenchmarkParams=paramA=value1,value2|paramB=value3,value4
if (project.hasProperty("benchmarkParams")) {
project.getProperty("benchmarkParams").split("[|]").each { param -> args '-p='+ param }
}

// Reduce forks to 3
args '-f=3'
args '-foe=true'
Expand Down

0 comments on commit 208763d

Please sign in to comment.