public final class EventStats extends Object implements JmxRefreshableStats<EventStats>, JmxStatsWithSmoothingWindow, JmxStatsWithReset
Class is supposed to work in single thread
| Modifier and Type | Method and Description |
|---|---|
void |
add(EventStats anotherStats) |
static EventStats |
create(Duration smoothingWindow)
Creates new EventStats with specified smoothing window
|
static EventStats |
createAccumulator() |
static String |
format(long count,
double rate,
String rateUnit,
DecimalFormat decimalFormat) |
String |
get() |
double |
getSmoothedRate()
Returns smoothed value of rate in events per second.
|
Duration |
getSmoothingWindow() |
long |
getTotalCount()
Returns total amount of recorded events
|
void |
recordEvent()
Records event and updates rate
|
void |
recordEvents(int events)
Records events and updates rate
|
void |
refresh(long timestamp) |
void |
resetStats()
Resets rate to zero
|
void |
setSmoothingWindow(Duration smoothingWindow) |
String |
toString() |
EventStats |
withPrecision(int precision) |
EventStats |
withRateUnit(String rateUnit) |
EventStats |
withScientificNotation() |
public static EventStats createAccumulator()
public static EventStats create(Duration smoothingWindow)
smoothingWindow - in secondspublic EventStats withRateUnit(String rateUnit)
public EventStats withPrecision(int precision)
public EventStats withScientificNotation()
public void resetStats()
resetStats in interface JmxStatsWithResetpublic void recordEvent()
public void recordEvents(int events)
events - number of eventspublic void refresh(long timestamp)
refresh in interface JmxRefreshablepublic void add(EventStats anotherStats)
add in interface JmxStats<EventStats>public static String format(long count, double rate, String rateUnit, DecimalFormat decimalFormat)
public double getSmoothedRate()
Value may be delayed. Last update was performed during recordEvent() method invocation
public long getTotalCount()
public Duration getSmoothingWindow()
getSmoothingWindow in interface JmxStatsWithSmoothingWindowpublic void setSmoothingWindow(Duration smoothingWindow)
setSmoothingWindow in interface JmxStatsWithSmoothingWindowpublic String get()
Copyright © 2019. All rights reserved.