Modifier and Type | Class and Description |
---|---|
static class |
Timer.Context
A timing context.
|
Constructor and Description |
---|
Timer()
|
Timer(Meter meter,
Histogram histogram,
Clock clock) |
Timer(Reservoir reservoir)
|
Timer(Reservoir reservoir,
Clock clock)
|
Modifier and Type | Method and Description |
---|---|
long |
getCount()
Returns the number of events which have been marked.
|
double |
getFifteenMinuteRate()
Returns the fifteen-minute moving average rate at which events have
occurred since the meter was created.
|
double |
getFiveMinuteRate()
Returns the five-minute moving average rate at which events have
occurred since the meter was created.
|
double |
getMeanRate()
Returns the mean rate at which events have occurred since the meter was created.
|
double |
getOneMinuteRate()
Returns the one-minute moving average rate at which events have
occurred since the meter was created.
|
Snapshot |
getSnapshot()
Returns a snapshot of the values.
|
Timer.Context |
time()
Returns a new
Timer.Context . |
<T> T |
time(Callable<T> event)
Times and records the duration of event.
|
void |
time(Runnable event)
Times and records the duration of event.
|
<T> T |
timeSupplier(Supplier<T> event)
Times and records the duration of event.
|
void |
update(Duration duration)
Adds a recorded duration.
|
void |
update(long duration,
TimeUnit unit)
Adds a recorded duration.
|
public Timer()
public Timer(Reservoir reservoir)
reservoir
- the Reservoir
implementation the timer should usepublic void update(long duration, TimeUnit unit)
duration
- the length of the durationunit
- the scale unit of duration
public void update(Duration duration)
duration
- the Duration
to add to the timer. Negative or zero value are ignored.public <T> T time(Callable<T> event) throws Exception
T
- the type of the value returned by event
event
- a Callable
whose Callable.call()
method implements a process
whose duration should be timedevent
Exception
- if event
throws an Exception
public <T> T timeSupplier(Supplier<T> event)
time(Callable)
method.T
- the type of the value returned by event
event
- a Supplier
whose Supplier.get()
method implements a process
whose duration should be timedevent
public void time(Runnable event)
event
- a Runnable
whose Runnable.run()
method implements a process
whose duration should be timedpublic Timer.Context time()
Timer.Context
.Timer.Context
Timer.Context
public long getCount()
Metered
public double getFifteenMinuteRate()
Metered
getFifteenMinuteRate
in interface Metered
public double getFiveMinuteRate()
Metered
getFiveMinuteRate
in interface Metered
public double getMeanRate()
Metered
getMeanRate
in interface Metered
public double getOneMinuteRate()
Metered
getOneMinuteRate
in interface Metered
public Snapshot getSnapshot()
Sampling
getSnapshot
in interface Sampling
Copyright © 2011. All rights reserved.