Package com.codahale.metrics
Class SlidingTimeWindowReservoir
- java.lang.Object
-
- com.codahale.metrics.SlidingTimeWindowReservoir
-
-
Constructor Summary
Constructors Constructor Description SlidingTimeWindowReservoir(long window, TimeUnit windowUnit)
Creates a newSlidingTimeWindowReservoir
with the given window of time.SlidingTimeWindowReservoir(long window, TimeUnit windowUnit, Clock clock)
Creates a newSlidingTimeWindowReservoir
with the given clock and window of time.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Snapshot
getSnapshot()
Returns a snapshot of the reservoir's values.int
size()
Returns the number of values recorded.void
update(long value)
Adds a new recorded value to the reservoir.
-
-
-
Constructor Detail
-
SlidingTimeWindowReservoir
public SlidingTimeWindowReservoir(long window, TimeUnit windowUnit)
Creates a newSlidingTimeWindowReservoir
with the given window of time.- Parameters:
window
- the window of timewindowUnit
- the unit ofwindow
-
SlidingTimeWindowReservoir
public SlidingTimeWindowReservoir(long window, TimeUnit windowUnit, Clock clock)
Creates a newSlidingTimeWindowReservoir
with the given clock and window of time.- Parameters:
window
- the window of timewindowUnit
- the unit ofwindow
clock
- theClock
to use
-
-
Method Detail
-
size
public int size()
Description copied from interface:Reservoir
Returns the number of values recorded.
-
update
public void update(long value)
Description copied from interface:Reservoir
Adds a new recorded value to the reservoir.
-
getSnapshot
public Snapshot getSnapshot()
Description copied from interface:Reservoir
Returns a snapshot of the reservoir's values.- Specified by:
getSnapshot
in interfaceReservoir
- Returns:
- a snapshot of the reservoir's values
-
-