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 . |
boolean |
isValid()
Indicates whether this
TimeStampedMetric 's current value is a
valid one. |
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 TimeStampedTimer
public 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 TimeStampedTimer
uid
- UID to assign to the resulting TimeStampedTimer
IllegalArgumentException
- if a null value is supplied for either
the TimerDescriptor
or MetricRegistry
argumentpublic TimerDataPoint extractDataPoint()
TimerDataPoint
from this object.extractDataPoint
in interface TimeStampedMetric
TimerDataPoint
public double get75thPercentile()
TimeStampedTimer
.public double get95thPercentile()
TimeStampedTimer
.public double get98thPercentile()
TimeStampedTimer
.public double get99thPercentile()
TimeStampedTimer
.public long getCount()
getCount
in interface com.codahale.metrics.Counting
getCount
in interface com.codahale.metrics.Metered
getCount
in class com.codahale.metrics.Timer
public TimerDescriptor getDescriptor()
TimeStampedMetric
MetricDescriptor
that describes this TimeStampedMetric
object.getDescriptor
in interface TimeStampedMetric
MetricDescriptor
that describes this TimeStampedMetric
public long getMaximum()
TimeStampedTimer
.public double getMean()
TimeStampedTimer
.public double getMedian()
TimeStampedTimer
.public long getMinimum()
TimeStampedTimer
.public long getMsSpanned()
TimeStampedMetric
getMsSpanned
in interface TimeStampedMetric
public long getPreviousTimeStamp()
TimeStampedMetric
getPreviousTimeStamp
in interface TimeStampedMetric
public 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()
TimeStampedMetric
getUid
in interface TimeStampedMetric
public long getUpdateTimeStamp()
TimeStampedMetric
getUpdateTimeStamp
in interface TimeStampedMetric
public long[] getValues()
TimeStampedTimer
.public boolean isValid()
TimeStampedMetric
TimeStampedMetric
's current value is a
valid one. For example, it could be a non-numeric value like Double.NaN,
depending upon type and state of the TimeStampedMetric
.isValid
in interface TimeStampedMetric
true
if valid, false
otherwisepublic void reset()
reset
in interface TimeStampedMetric
public void setDescriptor(TimerDescriptor toSet)
TimerDescriptor
that specifies characteristics of this
TimeStampedTimer
.toSet
- the TimerDescriptor
for this objectpublic void setPreviousTimeStamp(long time)
TimeStampedMetric
setPreviousTimeStamp
in interface TimeStampedMetric
time
- previous time stamppublic void setUid(String toSet)
TimeStampedMetric
setUid
in interface TimeStampedMetric
toSet
- new UID for this objectpublic void setUpdateTimeStamp(long time)
TimeStampedMetric
setUpdateTimeStamp
in interface TimeStampedMetric
time
- update time stamppublic <T> T time(Callable<T> event) throws Exception
time
in class com.codahale.metrics.Timer
Exception
public String toDebugString()
public void update(int durationMs)
durationMs
- the duration in millisecondspublic void update(long durationMs)
durationMs
- the duration in millisecondspublic void updateTimeStamp()
TimeStampedMetric
updateTimeStamp
in interface TimeStampedMetric
Copyright © 2015. All Rights Reserved.