public enum Level extends Enum<Level>
Enum Constant and Description |
---|
Invocation
Invocation level: to be executed for each benchmark method execution.
|
Iteration
Iteration level: to be executed before/after each iteration of the benchmark.
|
Trial
Trial level: to be executed before/after each run of the benchmark.
|
Modifier and Type | Method and Description |
---|---|
static Level |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Level[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Level Trial
Trial is the set of benchmark iterations.
public static final Level Iteration
Iteration is the set of benchmark invocations.
public static final Level Invocation
WARNING: HERE BE DRAGONS! THIS IS A SHARP TOOL. MAKE SURE YOU UNDERSTAND THE REASONING AND THE IMPLICATIONS OF THE WARNINGS BELOW BEFORE EVEN CONSIDERING USING THIS LEVEL.
This level is only usable for benchmarks taking more than a millisecond
per single Benchmark
method invocation. It is a good idea to validate
the impact for your case on ad-hoc basis as well.
WARNING #1: Since we have to subtract the setup/teardown costs from the benchmark time, on this level, we have to timestamp *each* benchmark invocation. If the benchmarked method is small, then we saturate the system with timestamp requests, which introduce artificial latency, throughput, and scalability bottlenecks.
WARNING #2: Since we measure individual invocation timings with this level, we probably set ourselves up for (coordinated) omission. That means the hiccups in measurement can be hidden from timing measurement, and can introduce surprising results. For example, when we use timings to understand the benchmark throughput, the omitted timing measurement will result in lower aggregate time, and fictionally *larger* throughput.
WARNING #3: In order to maintain the same sharing behavior as other
Levels, we sometimes have to synchronize (arbitrage) the access to
State
objects. Other levels do this outside the measurement,
but at this level, we have to synchronize on *critical path*, further
offsetting the measurement.
WARNING #4: Current implementation allows the helper method execution
at this Level to overlap with the benchmark invocation itself in order
to simplify arbitrage. That matters in multi-threaded benchmarks, when
one worker thread executing Benchmark
method may observe other
worker thread already calling TearDown
for the same object.
public static Level[] values()
for (Level c : Level.values()) System.out.println(c);
public static Level valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullCopyright © 2012–2020 Oracle. All rights reserved.