Constructor and Description |
---|
Timer(java.lang.String name)
Default constructor.
|
Timer(java.lang.String name,
long windowMs,
Clock clock)
Construct a
Timer with given window size |
Timer(java.lang.String name,
long windowMs,
int collisionBuffer,
Clock clock)
Construct a
Timer with given window size and collision buffer |
Timer(java.lang.String name,
Reservoir reservoir)
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getName()
Get the name of the timer
|
Snapshot |
getSnapshot()
Get the
Snapshot |
void |
update(long duration)
Add the time duration
|
void |
visit(MetricsVisitor visitor) |
public Timer(java.lang.String name)
SlidingTimeWindowReservoir
as the
default reservoir.name
- name of this timerpublic Timer(java.lang.String name, long windowMs, Clock clock)
Timer
with given window sizename
- name of this timerwindowMs
- the window size. unit is millisecondclock
- the clock for the reservoirpublic Timer(java.lang.String name, long windowMs, int collisionBuffer, Clock clock)
Timer
with given window size and collision buffername
- name of this timerwindowMs
- the window size. unit is millisecondcollisionBuffer
- amount of collisions allowed in one millisecond.clock
- the clock for the reservoirpublic Timer(java.lang.String name, Reservoir reservoir)
name
- name of this timerreservoir
- the given reservoirpublic void update(long duration)
duration
- time durationpublic void visit(MetricsVisitor visitor)
public java.lang.String getName()