Infra Params

Alex Averbuch alex.averbuch at neotechnology.com
Thu Jul 7 14:04:09 UTC 2016


In the JMH samples there is an example of how to access BenchmarkParams
during benchmark execution, e.g.:

@Setup
public void setup( BenchmarkParams params )


The sample I'm referring to is:
http://hg.openjdk.java.net/code-tools/jmh/file/13ae22114e22/jmh-samples/src/main/java/org/openjdk/jmh/samples/JMHSample_31_InfraParams.java

I'd like to do this, e.g., for retrieving/then storing per-benchmark
configuration data to the local file system, for later archiving.

But, when I try in my own project I get the following error:

[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:3.1:compile
(default-compile) on project jmh-benchmarks: Compilation failure:
Compilation failure:
[ERROR]
/Users/me/IdeaProjects/jmh-benchmarks/target/generated-sources/annotations/org/db/bench/core/generated/FindNode_countNodesWithLabel_jmhTest.java:[417,16]
method setUp in class org.db.bench.core.AbstractCoreBenchmark cannot be
applied to given types;
[ERROR] required: org.openjdk.jmh.infra.BenchmarkParams
[ERROR] found:
org.openjdk.jmh.infra.generated.BenchmarkParams_jmhType,org.openjdk.jmh.infra.generated.BenchmarkParams_jmhType
[ERROR] reason: actual and formal argument lists differ in length
[ERROR]
/Users/me/IdeaProjects/jmh-benchmarks/target/generated-sources/annotations/org/db/bench/core/generated/FindNode_countNodesWithLabelAndKeyAndValue_jmhTest.java:[426,16]
method setUp in class org.db.bench.core.AbstractCoreBenchmark cannot be
applied to given types;


AbstractCoreBenchmark is an abstract class with @State( Scope.Benchmark )

I've tried passing the BenchmarkParams instance into non-abstract children
of AbstractCoreBenchmark but get the same error

Thoughts?

Thanks in advance!
Alex


More information about the jmh-dev mailing list