public class FastTimer
extends com.codahale.metrics.Timer
Modifier and Type | Class and Description |
---|---|
static class |
FastTimer.Buckets
Defines the response time buckets to use.
|
Constructor and Description |
---|
FastTimer()
Constructs a new timer with default time window (60 seconds) and
default time buckets (fine).
|
FastTimer(int timeWindowSeconds,
FastTimer.Buckets buckets)
Constructs a new timer.
|
Modifier and Type | Method and Description |
---|---|
int |
getBucket(long duration)
Figure out which percentile bucket an event of a given duration belongs into.
|
long |
getBucketBound(int b)
Returns the upper bucket bound (inclusive) of a given bucket.
|
long |
getBucketValue(int b)
Returns the average value of a given bucket (the mean between its lower and upper bound).
|
long |
getCount()
Returns the all-time count of events this timer has seen.
|
double |
getFifteenMinuteRate() |
double |
getFiveMinuteRate() |
double |
getMeanRate() |
int |
getNumberOfBuckets()
Returns the number of response time buckets used by this timer.
|
double |
getOneMinuteRate() |
double |
getRate(int seconds)
Returns the average per-second rate of events this timer has seen.
|
com.codahale.metrics.Snapshot |
getSnapshot()
Returns a snapshot of this timer.
|
protected int |
getTime()
Returns the current absolute time (in seconds).
|
void |
update(long duration,
java.util.concurrent.TimeUnit unit)
Add an event to this timer.
|
public FastTimer()
public FastTimer(int timeWindowSeconds, FastTimer.Buckets buckets)
timeWindowSeconds
- the time window (in seconds) for this timerbuckets
- the type of buckets to use for response timespublic int getNumberOfBuckets()
public int getBucket(long duration)
duration
- the duration (in nanoseconds)public long getBucketBound(int b)
b
- the bucketpublic long getBucketValue(int b)
b
- the bucketprotected int getTime()
public double getRate(int seconds)
seconds
- the number of seconds over which to calculate the average ratepublic long getCount()
getCount
in interface com.codahale.metrics.Counting
getCount
in interface com.codahale.metrics.Metered
getCount
in class com.codahale.metrics.Timer
public double getFifteenMinuteRate()
getFifteenMinuteRate
in interface com.codahale.metrics.Metered
getFifteenMinuteRate
in class com.codahale.metrics.Timer
public double getFiveMinuteRate()
getFiveMinuteRate
in interface com.codahale.metrics.Metered
getFiveMinuteRate
in class com.codahale.metrics.Timer
public double getMeanRate()
getMeanRate
in interface com.codahale.metrics.Metered
getMeanRate
in class com.codahale.metrics.Timer
public double getOneMinuteRate()
getOneMinuteRate
in interface com.codahale.metrics.Metered
getOneMinuteRate
in class com.codahale.metrics.Timer
public com.codahale.metrics.Snapshot getSnapshot()
getSnapshot
in interface com.codahale.metrics.Sampling
getSnapshot
in class com.codahale.metrics.Timer
public void update(long duration, java.util.concurrent.TimeUnit unit)
update
in class com.codahale.metrics.Timer
duration
- the time duration of the eventunit
- the unit of time durationCopyright © 2011–2020 The Apache Software Foundation. All rights reserved.