public class LongAvgRate extends MapStatComponent<Long,LongAvgRate>
| Modifier and Type | Field and Description |
|---|---|
static long |
MIN_PERIOD
The minimum number of milliseconds for computing rate changes, to avoid
quantizing errors.
|
| Constructor and Description |
|---|
LongAvgRate(String name,
long periodMillis,
TimeUnit reportTimeUnit)
Creates an instance of this class.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(LongAvgRate other)
Update with more recent values from another stat.
|
void |
add(long value,
long time)
Adds a new value to the average, ignoring values that are less than
MIN_PERIOD milliseconds older than the last entry. |
void |
clear()
Resets the statistic to its initial state.
|
LongAvgRate |
copy()
Narrow the return type to the component type.
|
LongAvgRate |
copyLatest(LongAvgRate other)
Create and return a new stat that includes the most recent values from
this stat and another stat.
|
Long |
get()
Returns the current average rate, or 0 if no rate has been computed.
|
protected String |
getFormattedValue(boolean useCommas)
Returns the value of the statistic as a formatted string, either using
or not using commas as requested.
|
String |
getName()
Returns the name of this stat.
|
boolean |
isNotSet()
Returns whether the statistic is in its initial state.
|
String |
toString() |
getFormattedValuepublic static final long MIN_PERIOD
public String getName()
public void add(long value,
long time)
MIN_PERIOD milliseconds older than the last entry.value - the new valuetime - the current time in millisecondspublic void add(LongAvgRate other)
other - the other statpublic LongAvgRate copyLatest(LongAvgRate other)
other - the other statpublic Long get()
public void clear()
BaseStatpublic LongAvgRate copy()
MapStatComponentcopy in class MapStatComponent<Long,LongAvgRate>protected String getFormattedValue(boolean useCommas)
MapStatComponentgetFormattedValue in class MapStatComponent<Long,LongAvgRate>useCommas - whether to use commaspublic boolean isNotSet()
BaseStatCopyright © 2024. All rights reserved.