| ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
GenerateMicroBenchmark annotates the benchmark method.
JMH will produce the generated benchmark code for this method during compilation, register this method as the benchmark in the benchmark list, read out the default values from the annotations, and generally prepare the environment for the benchmark to run.
Benchmarks may use annotations to control different things in their operations. See org.openjdk.jmh.annotations
package for available annotations, or look through JMH samples for their canonical uses. As the rule of thumb, most annotations may be placed either at the GenerateMicroBenchmark
method, or at enclosing class.
GenerateMicroBenchmark
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:
State
classes, which JMH will inject while calling the method (see State
for more details), or JMH infrastructure classes, like Control
, or Blackhole
State
is placed on the enclosing class.If you want to benchmark methods which break these properties, you have to write them out specifically as the benchmark payload and call them from GenerateMicroBenchmark
method.
Benchmark method may declare Exceptions and Throwables to throw. Any exception actually raised and thrown will be treated as benchmark failure.
| ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |