Search code examples
javabenchmarkingjmh

Overview of nested methods in JMH benchmark


I haven't been able to find anything that really answers my question, so here it goes.

I have a written a Java library that I wish to perform benchmarks on using a separate Java project that has JMH as a dependency. I'm able to write a benchmark method that performs the benchmark however this is not detailed enough for my needs. I want to know what methods of the library are taking up the most amount of time. This way I have a better understanding of possible bottlenecks and where to start optimizing my library.

This means I want to have a detailed tree report in which underlying method calls are shown and how long it took to execute them, instead of just being able to view the total benchmark method execution time.

Is JMH able to do this out of the box?


Solution

  • As mentioned by Eugene, I was looking for a profiler. Java Flight Recorder (JFR) is a tool for collecting diagnostic and profiling data about a running Java application and I was able to use this to gain an insight into my application's performance.