Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

1.4K
Visualizações
Java Microbenchmark Harness gives an error Unable to find the resource: /META-INF/BenchmarkList

I want to measure the performance of Fibonacci function with JMH. but when compiling I get the following error:

Exception in thread "main" java.lang.RuntimeException: ERROR: Unable to find the resource: /META-INF/BenchmarkList
    at jmh.core@1.34/org.openjdk.jmh.runner.AbstractResourceReader.getReaders(AbstractResourceReader.java:98)
    at jmh.core@1.34/org.openjdk.jmh.runner.BenchmarkList.find(BenchmarkList.java:124)
    at jmh.core@1.34/org.openjdk.jmh.runner.Runner.internalRun(Runner.java:253)
    at jmh.core@1.34/org.openjdk.jmh.runner.Runner.run(Runner.java:209)
    at jmh.core@1.34/org.openjdk.jmh.Main.main(Main.java:71)
    at project/Mypackage.BenchmarkRunner.main(BenchmarkRunner.java:6)

I use IntelliJ IDEA I use openJDK 16

I tried to add in the Resources directory the folder and file /META-INF/BenchmarkList I have this error :

No matching benchmarks. Miss-spelled regexp?
Use EXTRA verbose mode to debug the pattern matching.

my main class who start the benchmark:

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

}

And the class with Fibonnaci methods whose performance I want to measure

public class TestClassMesurment {

    @Benchmark
    @BenchmarkMode(Mode.AverageTime)
    @Fork(value = 1)
    @Warmup(iterations = 2)
    @Measurement(iterations = 1)
    public void init() {

        fib(52);
        //fibbonaci(300);
    }

    static int fib(int n) {
        if (n<2) return 1;
        else return fib(n-1) + fib(n-2);
    }

    
    double fibbonaci(int n){
        double prev=0d, next=1d, result=0d;
        for (int i = 0; i < n; i++) {
            result=prev+next;
            prev=next;
            next=result;
        }
        return result;
    }
}
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

/META-INF/BenchmarkList is generated automatically at compilation time, you don't need to create it manually. If this file is not created this usually means that annotation processing is off. Please turn it on.

Also the way you run the benchmark differs from the one specified in samples. Try to use that approach as well.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda