Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

1.4K
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda