http://tutorials.jenkov.com/java-performance/jmh.html
https://antoniogoncalves.org/2015/01/15/micro-benchmarking-with-jmh-measure-dont-guess/
http://stackoverflow.com/questions/28936559/run-micro-benchmark-in-application-servers-jmh
When you build your JMH benchmarks, Maven will always generate a JAR file named
benchmarks.jar
in the target
directory (Maven's standard output directory).
The
benchmarks.jar
file contains everything needed to run your benchmarks. It contains your compiled benchmark classes as well as all JMH classes needed to run the benchmark.
If your benchmarks has any external dependencies (JAR files from other projects needed to run your benchmarks), declare these dependencies inside the Maven
pom.xml
, and they will be included in thebenchmarks.jar
too.
Since
benchmarks.jar
is fully self contained, you can copy that JAR file to another computer to run your JMH benchmarks on that computer.https://antoniogoncalves.org/2015/01/15/micro-benchmarking-with-jmh-measure-dont-guess/
http://stackoverflow.com/questions/28936559/run-micro-benchmark-in-application-servers-jmh
* <p>{@link Benchmark} demarcates the benchmark payload, and JMH treats it specifically
* as the wrapper which contains the benchmark code. In order to run the benchmark reliably,
* JMH enforces a few stringent properties for these wrapper methods, including, but not
* limited to:</p>
@Benchmark
is the annotation demarcating the piece of code JMH should treat as benchmark body. It is not a magic annotation which measures any given method elsewhere in the program. And, you are not supposed to call @Benchmark
methods on your own.
What you want is not benchmark, it's a tracing/monitoring/profiling solution which can instrument and account all the stages the request gets through. JMH is not such a solution, you should look elsewhere.