public class TimeStampedTimer extends com.codahale.metrics.Timer implements TimeStampedMetric
Timer class that provides an association of
sliding time window Timer values with time stamps.| Constructor and Description |
|---|
TimeStampedTimer(MetricRegistry registry,
TimerDescriptor descriptor)
Constructs a
TimeStampedTimer with the specified characteristics
using the specified MetricRegistry. |
TimeStampedTimer(MetricRegistry registry,
TimerDescriptor descriptor,
String uid)
Constructs a
TimeStampedTimer with the specified UID and other
characteristics using the specified MetricRegistry. |
| Modifier and Type | Method and Description |
|---|---|
TimerDataPoint |
extractDataPoint()
Extract a
TimerDataPoint from this object. |
double |
get75thPercentile()
Gets the duration, in milliseconds, at the 75th percentile of all
durations currently encompassed within the the sliding time window of
this
TimeStampedTimer. |
double |
get95thPercentile()
Gets the duration, in milliseconds, at the 95th percentile of all
durations currently encompassed within the the sliding time window of
this
TimeStampedTimer. |
double |
get98thPercentile()
Gets the duration, in milliseconds, at the 98th percentile of all
durations currently encompassed within the the sliding time window of
this
TimeStampedTimer. |
double |
get99thPercentile()
Gets the duration, in milliseconds, at the 99th percentile of all
durations currently encompassed within the the sliding time window of
this
TimeStampedTimer. |
long |
getCount() |
TimerDescriptor |
getDescriptor()
Gets the
MetricDescriptor that describes this TimeStampedMetric object. |
long |
getMaximum()
Gets the maximum, in milliseconds, of all durations currently encompassed
within the sliding time window of this
TimeStampedTimer. |
double |
getMean()
Gets the mean, in milliseconds, of the durations currently encompassed
within the sliding time window of this
TimeStampedTimer. |
double |
getMedian()
Gets the median, in milliseconds, of all durations currently encompassed
within the sliding time window of this
TimeStampedTimer. |
long |
getMinimum()
Gets the minimum, in milliseconds, of all durations currently encompassed
within the sliding time window of this
TimeStampedTimer. |
long |
getMsSpanned()
Determines the number of milliseconds spanned between the latest (update)
time stamp and the oldest (previous) time stamp, accounting for roll-over
of the time stamp.
|
long |
getPreviousTimeStamp()
Gets the previous time stamp.
|
double |
getRate()
Gets the rate of durations for the timer.
|
int |
getSlidingWindowMinutes()
Gets the number of minutes spanned by the sliding time window of this
TimeStampedTimer. |
double |
getStandardDeviation()
Gets the standard deviation, in milliseconds, of the durations currently
encompassed within the sliding time window of this
TimeStampedTimer. |
protected TimeStampManager |
getTimeStampManager()
Gets the
TimeStampManager that this object uses to manage its
associated time stamps. |
String |
getUid()
Gets the UID.
|
long |
getUpdateTimeStamp()
Gets the update time stamp.
|
long[] |
getValues()
Gets the actual millisecond durations currently encompassed within the
sliding time window of this
TimeStampedTimer. |
void |
reset()
Prepares the timer for use in a new time period.
|
void |
setDescriptor(TimerDescriptor toSet)
Sets the
TimerDescriptor that specifies characteristics of this
TimeStampedTimer. |
void |
setPreviousTimeStamp(long time)
Sets the previous time stamp.
|
void |
setUid(String toSet)
Sets the UID of this object.
|
void |
setUpdateTimeStamp(long time)
Sets the update time stamp.
|
<T> T |
time(Callable<T> event) |
String |
toDebugString()
Gets a detailed representation of this object to facilitate debugging.
|
String |
toString() |
void |
update(int durationMs)
Adds a duration.
|
void |
update(long durationMs)
Adds a duration.
|
void |
updateTimeStamp()
Convenience method that sets the update time stamp to the current time.
|
public TimeStampedTimer(MetricRegistry registry, TimerDescriptor descriptor)
TimeStampedTimer with the specified characteristics
using the specified MetricRegistry.registry - MetricRegistry to use for allocating this objectdescriptor - TimerDescriptor that specifies various
characteristics of the resulting TimeStampedTimerpublic TimeStampedTimer(MetricRegistry registry, TimerDescriptor descriptor, String uid)
TimeStampedTimer with the specified UID and other
characteristics using the specified MetricRegistry.registry - MetricRegistry to use for allocating this objectdescriptor - TimerDescriptor that specifies various
characteristics of the resulting TimeStampedTimeruid - UID to assign to the resulting TimeStampedTimerIllegalArgumentException - if a null value is supplied for either
the TimerDescriptor or MetricRegistry argumentpublic TimerDataPoint extractDataPoint()
TimerDataPoint from this object.extractDataPoint in interface TimeStampedMetricTimerDataPointpublic double get75thPercentile()
TimeStampedTimer.public double get95thPercentile()
TimeStampedTimer.public double get98thPercentile()
TimeStampedTimer.public double get99thPercentile()
TimeStampedTimer.public long getCount()
getCount in interface com.codahale.metrics.CountinggetCount in interface com.codahale.metrics.MeteredgetCount in class com.codahale.metrics.Timerpublic TimerDescriptor getDescriptor()
TimeStampedMetricMetricDescriptor that describes this TimeStampedMetric object.getDescriptor in interface TimeStampedMetricMetricDescriptor that describes this TimeStampedMetricpublic long getMaximum()
TimeStampedTimer.public double getMean()
TimeStampedTimer.public double getMedian()
TimeStampedTimer.public long getMinimum()
TimeStampedTimer.public long getMsSpanned()
TimeStampedMetricgetMsSpanned in interface TimeStampedMetricpublic long getPreviousTimeStamp()
TimeStampedMetricgetPreviousTimeStamp in interface TimeStampedMetricpublic double getRate()
TimeStampedTimer.public int getSlidingWindowMinutes()
TimeStampedTimer.public double getStandardDeviation()
TimeStampedTimer.protected TimeStampManager getTimeStampManager()
TimeStampManager that this object uses to manage its
associated time stamps.TimeStampManager for this objectpublic String getUid()
TimeStampedMetricgetUid in interface TimeStampedMetricpublic long getUpdateTimeStamp()
TimeStampedMetricgetUpdateTimeStamp in interface TimeStampedMetricpublic long[] getValues()
TimeStampedTimer.public void reset()
reset in interface TimeStampedMetricpublic void setDescriptor(TimerDescriptor toSet)
TimerDescriptor that specifies characteristics of this
TimeStampedTimer.toSet - the TimerDescriptor for this objectpublic void setPreviousTimeStamp(long time)
TimeStampedMetricsetPreviousTimeStamp in interface TimeStampedMetrictime - previous time stamppublic void setUid(String toSet)
TimeStampedMetricsetUid in interface TimeStampedMetrictoSet - new UID for this objectpublic void setUpdateTimeStamp(long time)
TimeStampedMetricsetUpdateTimeStamp in interface TimeStampedMetrictime - update time stamppublic <T> T time(Callable<T> event) throws Exception
time in class com.codahale.metrics.TimerExceptionpublic String toDebugString()
public void update(int durationMs)
durationMs - the duration in millisecondspublic void update(long durationMs)
durationMs - the duration in millisecondspublic void updateTimeStamp()
TimeStampedMetricupdateTimeStamp in interface TimeStampedMetricCopyright © 2014. All Rights Reserved.