2

I have tried multiple tutorials to make a poc using jmh inside my test package but always faced: No matching benchmarks. Miss-spelled regexp. My latest code:

        <dependency>
            <groupId>org.openjdk.jmh</groupId>
            <artifactId>jmh-core</artifactId>
            <version>1.35</version>
        </dependency>
        <dependency>
            <groupId>org.openjdk.jmh</groupId>
            <artifactId>jmh-generator-annprocess</artifactId>
            <version>1.35</version>
        </dependency>

I downloaded 'JMH Java Microbenchmark Harness' plugin ( I tried also JMHack)

created these two classes


public class TestBenchmark
{

    @Benchmark
    public void init() {
        // Do nothing
    }

}

and

public class BenchmarkRunner {
    public static void main(String[] args) throws Exception {
        org.openjdk.jmh.Main.main(args);
    }
} 

And it's not working,

I will list couple of articles I already tried

from stackoverflow

This tutorial

medium article

I think I must create a new project but It would be great if I could apply it to an existing project

Ed .d
  • 23
  • 1
  • 3

1 Answers1

1

Once I did simple integration of JMH with Spring Boot, you can find an example in https://github.com/stsypanov/spring-boot-benchmark

Sergey Tsypanov
  • 3,265
  • 3
  • 8
  • 34
  • Thank you a lot, the missing part was wrong dependencies: before I was adding jmh-core along with jmh-annprocess as dependencies Here we added jmh-core as a dependency and used jmh-annprocess as a plugin – Ed .d Oct 08 '22 at 13:50