TransactionBenchmark
- public abstract class TransactionBenchmark implements Serializable
The TransactionBenchmark object allows to store the time which some actions take. At its core, it consists of:
A list of named Measurements.A list of named SubBenchmarks.
Each measurement may be recorded on multiple occasions, the stored Measurement objects keep a statistic about the total and average recorded times.
Fields
isActive
- protected static final transient boolean isActive
logger
- public final transient Logger logger
measurements
- protected final Map<String, Measurement> measurements
since
- long since
stackTraceElements
- protected StackTraceElement[] stackTraceElements
subBenchmarks
- protected final Map<String, SubBenchmark> subBenchmarks
Constructors
TransactionBenchmark
- protected TransactionBenchmark()
Methods
addMeasurement
addMeasurement
addMeasurement
- public void addMeasurement(Measurement measurement)
Add a measurement.
- Parameters:
measurement –
called_from
createBenchmark
- public TransactionBenchmark createBenchmark(String name)
Create a new independent
TransactionBenchmark
. Existing benchmarks with the same name are overwritten by this method.This is for starting a series of measurements from a clean slate.
However, the Measurements and Benchmarks are still recorded in the
RootBenchmark
too.- Parameters:
name – the name of the new
TransactionBenchmark
.
- Returns:
a new
TransactionBenchmark
createBenchmark
- public TransactionBenchmark createBenchmark(Class<?> class1)
Create a sub-benchmark with the name of the given class, overwriting existing ones with the same name.
getBenchmark
- public TransactionBenchmark getBenchmark(String name)
Return (and create if necessary) the sub-benchmark with the given name.
getBenchmark
- public TransactionBenchmark getBenchmark(Class<?> class1)
Return (and create if necessary) the sub-benchmark with the name of the given class.
getMeasurements
- public Iterable<Measurement> getMeasurements()
getName
getRootInstance
- public static TransactionBenchmark getRootInstance()
getSubBenchmarks
- public Iterable<SubBenchmark> getSubBenchmarks()
toElement
- public Element toElement()