|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.javasimon.callback.CallbackSkeleton
org.javasimon.callback.quantiles.QuantilesCallback
public abstract class QuantilesCallback
Callback which stores data in buckets to compute quantiles. The #createBuckets(org.javasimon.Stopwatch) should be implemented to configure the width and resolution of buckets. Then {@link Buckets} are stored among Simon attributes. There are 2 implementations:
Buckets| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.javasimon.callback.Callback |
|---|
Callback.Event |
| Field Summary | |
|---|---|
static String |
ATTR_NAME_BUCKETS
Simon attribute name of the buckets stored in Simons after warmup time. |
private BucketsType |
bucketsType
Type of the buckets: linear or exponential |
private LogTemplate<Split> |
enabledStopwatchLogTemplate
SLF4J log template shared by all stopwatches. |
private boolean |
logEnabled
Global flag indicating whether last splits should be logged once in a while. |
| Constructor Summary | |
|---|---|
protected |
QuantilesCallback()
Default constructor. |
protected |
QuantilesCallback(BucketsType bucketsType)
Constructor with buckets type |
| Method Summary | |
|---|---|
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)
Get the buckets attribute. |
BucketsType |
getBucketsType()
Get buckets type |
protected Buckets |
getOrCreateBuckets(Stopwatch stopwatch)
Get the buckets attribute or create it if it does not exist. |
boolean |
isLogEnabled()
|
void |
onSimonReset(Simon simon)
When the Stopwatch is reseted, so are the buckets. |
void |
onStopwatchAdd(Stopwatch stopwatch,
long value,
StopwatchSample sample)
When a split is added, if buckets have been initialized, the value is added to appropriate bucket. |
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,
long value)
Called internally when there is a new split on a Stopwatch from {@link #onStopwatchAdd(org.javasimon.Stopwatch, long, org.javasimon.StopwatchSample). |
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)
Get the buckets attribute and sample them |
void |
setLogEnabled(boolean logEnabled)
|
| Methods inherited from class org.javasimon.callback.CallbackSkeleton |
|---|
cleanup, initialize, onCounterDecrease, onCounterIncrease, onCounterSet, onManagerClear, onManagerMessage, onManagerWarning, onSimonCreated, onSimonDestroyed, onStopwatchStart |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String ATTR_NAME_BUCKETS
private boolean logEnabled
private final LogTemplate<Split> enabledStopwatchLogTemplate
private BucketsType bucketsType
| Constructor Detail |
|---|
protected QuantilesCallback()
protected QuantilesCallback(BucketsType bucketsType)
bucketsType - Type of buckets| Method Detail |
|---|
public BucketsType getBucketsType()
public boolean isLogEnabled()
public void setLogEnabled(boolean logEnabled)
protected LogTemplate<Split> createLogTemplate(Stopwatch stopwatch)
stopwatch - Stopwatch
public 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 max
protected abstract Buckets createBuckets(Stopwatch stopwatch)
stopwatch - Stopwatch
protected 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.
protected void onStopwatchSplit(Stopwatch stopwatch,
long value)
public void onStopwatchStop(Split split,
StopwatchSample sample)
onStopwatchStop in interface CallbackonStopwatchStop in class CallbackSkeletonsplit - stopped Splitsample - stopwatch sampled after the stop
public void onStopwatchAdd(Stopwatch stopwatch,
Split split,
StopwatchSample sample)
onStopwatchAdd in interface CallbackonStopwatchAdd in class CallbackSkeletonstopwatch - modified Stopwatchsplit - added split objectsample - stopwatch sampled after the add
public void onStopwatchAdd(Stopwatch stopwatch,
long value,
StopwatchSample sample)
onStopwatchAdd in interface CallbackonStopwatchAdd in class CallbackSkeletonstopwatch - modified Stopwatchvalue - added split time in nssample - stopwatch sampled after the addpublic void onSimonReset(Simon simon)
onSimonReset in interface CallbackonSimonReset in class CallbackSkeletonsimon - reset Simon
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||