public abstract class QuantilesCallback extends CallbackSkeleton
createBuckets(org.javasimon.Stopwatch)
should be
implemented to configure the width and resolution of buckets.
Then Buckets
are stored among Simon attributes.
There are 2 implementations:
AutoQuantilesCallback
tries to determine the best configuration for each Stopwatch.FixedQuantilesCallback
uses a fixed configuration for all Stopwatches.Buckets
Callback.Event
Modifier and Type | Field and Description |
---|---|
static String |
ATTR_NAME_BUCKETS
Simon attribute name of the buckets stored in Simons after warmup time.
|
Modifier | Constructor and Description |
---|---|
protected |
QuantilesCallback()
Default constructor.
|
protected |
QuantilesCallback(BucketsType bucketsType)
Constructor with buckets type.
|
Modifier and Type | Method and Description |
---|---|
protected abstract Buckets |
createBuckets(Stopwatch stopwatch)
Create Buckets for given stopwatch.
|
protected Buckets |
createBuckets(Stopwatch stopwatch,
long min,
long max,
int bucketNb)
Factory method to create a Buckets object using given configuration.
|
protected LogTemplate<Split> |
createLogTemplate(Stopwatch stopwatch)
Create log template for given stopwatch.
|
static Buckets |
getBuckets(Stopwatch stopwatch)
Returns the buckets attribute.
|
BucketsType |
getBucketsType()
Returns buckets type.
|
protected Buckets |
getOrCreateBuckets(Stopwatch stopwatch)
Returns the buckets attribute or create it if it does not exist.
|
boolean |
isLogEnabled() |
void |
onStopwatchAdd(Stopwatch stopwatch,
Split split,
StopwatchSample sample)
When a split is added, if buckets have been initialized, the value is added to appropriate bucket.
|
protected void |
onStopwatchSplit(Stopwatch stopwatch,
Split split)
Called when there is a new split on a Stopwatch, either
onStopwatchStop(org.javasimon.Split, org.javasimon.StopwatchSample) or onStopwatchAdd(org.javasimon.Stopwatch, org.javasimon.Split, org.javasimon.StopwatchSample) . |
void |
onStopwatchStop(Split split,
StopwatchSample sample)
When a split is stopped, if buckets have been initialized, the value
is added to appropriate bucket.
|
static BucketsSample |
sampleBuckets(Stopwatch stopwatch)
Returns the buckets attribute and sample them.
|
void |
setLogEnabled(boolean logEnabled) |
cleanup, initialize, onCounterDecrease, onCounterIncrease, onCounterSet, onManagerClear, onManagerMessage, onManagerWarning, onSimonCreated, onSimonDestroyed, onStopwatchStart
public static final String ATTR_NAME_BUCKETS
protected QuantilesCallback()
protected QuantilesCallback(BucketsType bucketsType)
bucketsType
- Type of bucketspublic BucketsType getBucketsType()
public boolean isLogEnabled()
public void setLogEnabled(boolean logEnabled)
protected LogTemplate<Split> createLogTemplate(Stopwatch stopwatch)
stopwatch
- Stopwatchpublic static Buckets getBuckets(Stopwatch stopwatch)
protected final Buckets createBuckets(Stopwatch stopwatch, long min, long max, int bucketNb)
stopwatch
- Target Stopwatchmin
- Min boundmax
- Max boundbucketNb
- Number of buckets between min and maxprotected abstract Buckets createBuckets(Stopwatch stopwatch)
createBuckets(org.javasimon.Stopwatch, long, long, int)
to create a new buckets object.stopwatch
- Stopwatchprotected final Buckets getOrCreateBuckets(Stopwatch stopwatch)
public static BucketsSample sampleBuckets(Stopwatch stopwatch)
protected void onStopwatchSplit(Stopwatch stopwatch, Split split)
onStopwatchStop(org.javasimon.Split, org.javasimon.StopwatchSample)
or onStopwatchAdd(org.javasimon.Stopwatch, org.javasimon.Split, org.javasimon.StopwatchSample)
.
If buckets have been initialized, the value is added to appropriate bucket.public void onStopwatchStop(Split split, StopwatchSample sample)
onStopwatchStop
in interface Callback
onStopwatchStop
in class CallbackSkeleton
split
- stopped Splitsample
- stopwatch sampled after the stoppublic void onStopwatchAdd(Stopwatch stopwatch, Split split, StopwatchSample sample)
onStopwatchAdd
in interface Callback
onStopwatchAdd
in class CallbackSkeleton
stopwatch
- modified Stopwatchsplit
- added split objectsample
- stopwatch sampled after the addCopyright © 2019. All rights reserved.