@Inherited @Target(value={METHOD,TYPE}) @Retention(value=RUNTIME) public @interface OperationsPerInvocation
OperationsPerInvocation annotations allows to communicate the benchmark does more than one operation, and let JMH to adjust the scores appropriately.
For example, a benchmark which uses the internal loop to have multiple operations, may want to measure the performance of a single operation:
@Benchmark @OperationsPerInvocation(10) public void test() { for (int i = 0; i < 10; i++) { // do something } }
This annotation may be put at Benchmark
method to have effect on that method
only, or at the enclosing class instance to have the effect over all Benchmark
methods in the class.
Modifier and Type | Optional Element and Description |
---|---|
int |
value |
public abstract int value
Benchmark
call.Copyright © 2012–2020 Oracle. All rights reserved.