Package org.openjdk.jmh.annotations
Annotation Type AuxCounters
-
@Target(TYPE) @Retention(RUNTIME) public @interface AuxCounters
AuxCountersannotation can be used to markStateobjects as the bearers of auxiliary secondary results. Marking the class with this annotation will make JMH to treat its public fields and result-returning public methods as the base for the secondary benchmark metrics.Properties:
- Auxiliary counters are not available for every
BenchmarkMode, because not every mode counts time or operations.Mode.AverageTimeandMode.Throughputare always supported. AuxCountersannotation is only available forScope.Threadstate objects. It is a compile-time error to use it with other states. This means the counters are thread-local in nature.- Only public fields and methods are considered as metrics. If you don't want a field/method to be captured as metric, do not make it public.
- Only numeric fields and numeric-returning methods are considered as
metrics. These include all primitives and their corresponding boxed counterTypes,
except
boolean/Booleanandchar/Character. It is a compile-time error to use the public field/method with incompatible type. - Methods with
voidreturn type are exempted from type checking. This means helperSetupandTearDownmethods are fine inAuxCounters. - Public fields in
AuxCountersinstances would be reset before starting the iteration, and read back at the end of iteration. This allows benchmark code to avoid complicated lifecycle handling for these objects. - The counter names are generated from field/method names. The namespace for
counters is shared across all states participating in the run. JMH will fail to
compile the benchmark if there is an ambiguity around what counter comes from
what
AuxCountersclass.
CAVEAT: THIS IS AN EXPERIMENTAL API, it may be changed or removed in future without prior warning. This is a sharp tool, use with care.
- Auxiliary counters are not available for every
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description AuxCounters.Typevalue
-
-
-
Element Detail
-
value
AuxCounters.Type value
- Default:
- org.openjdk.jmh.annotations.AuxCounters.Type.OPERATIONS
-
-