public interface Interval extends Serializable
Metric instance.
The life of a Metric is conceptually a sequence of non-overlapping intervals.
Each Interval has a duration that is a whole number of seconds, and all intervals
for a given Metric have a uniform duration. Each Interval has a
start time, which can be determined from the start time of the previous Interval
of the Metric and its duration.| Modifier and Type | Method and Description |
|---|---|
void |
add(int count)
Registers the occurrence of n new events.
|
long |
getCumulativeEvents()
Gets the total number of events, including those that occurred
in previous intervals.
|
long |
getDuration()
Gets the duration, in milliseconds, of this
Interval |
float |
getEventRatePerSecond()
Returns the computed event rate per second during this
Interval. |
long |
getEvents()
Gets the number of events counted during this interval.
|
long |
getStartTime()
Gets a timestamp corresponding to the start of this
Interval
in System.currentTimeMillis() format. |
long |
intervalsBefore(long time)
Returns the number of intervals that have elapsed between this
Interval and the time specified by the argument. |
boolean |
isPast()
Returns true if the current time is after the end of this interval.
|
void |
setClosed(boolean closed)
Marks the interval as open or closed.
|
long getStartTime()
Interval
in System.currentTimeMillis() format.Intervallong getDuration()
Intervallong getEvents()
float getEventRatePerSecond()
Interval.
If the current time falls within this interval, consider only the time that has passed.
Otherwise, consider the entire duration of the interval.long getCumulativeEvents()
boolean isPast()
void add(int count)
count - number of events to be countedvoid setClosed(boolean closed)
long intervalsBefore(long time)
Interval and the time specified by the argument.time - typically the current timeCopyright © 2015. All rights reserved.