public class StatManager extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
PROP_STAT_FULL
default false
|
| Constructor and Description |
|---|
StatManager(I2PAppContext context)
The stat manager should only be constructed and accessed through the
application context.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addRateData(String name,
long data)
Update the given rate statistic, taking note that the given data point was received (and recalculating all rates).
|
void |
addRateData(String name,
long data,
long eventDuration)
update the given rate statistic, taking note that the given data point was received (and recalculating all rates)
|
void |
coalesceStats() |
void |
createFrequencyStat(String name,
String description,
String group,
long[] periods)
Create a new statistic to monitor the frequency of some event.
|
void |
createRateStat(String name,
String description,
String group,
long[] periods)
Create a new statistic to monitor the average value and confidence of some action.
|
void |
createRequiredFrequencyStat(String name,
String description,
String group,
long[] periods)
Create a new statistic to monitor the frequency of some event.
|
void |
createRequiredRateStat(String name,
String description,
String group,
long[] periods)
Create a new statistic to monitor the average value and confidence of some action.
|
FrequencyStat |
getFrequency(String name)
Misnamed, as it returns a FrequencyStat, not a Frequency.
|
Set<String> |
getFrequencyNames()
Get the names of all frequency statistics.
|
RateStat |
getRate(String name)
Misnamed, as it returns a RateStat, not a Rate.
|
Set<String> |
getRateNames()
Get the names of all rate statistics.
|
Map<String,SortedSet<String>> |
getStatsByGroup()
Group name (untranslated String) to a SortedSet of untranslated stat names.
|
boolean |
ignoreStat(String statName)
Save memory by not creating stats unless they are required for router operation.
|
boolean |
isFrequency(String statName)
is the given stat a monitored frequency?
|
boolean |
isRate(String statName)
is the given stat a monitored rate?
|
void |
removeRateStat(String name) |
void |
shutdown()
Shut down the statistics manager and clear all statistics.
|
void |
store(OutputStream out,
String prefix)
Serializes all Frequencies and Rates to the provided OutputStream
|
void |
updateFrequency(String name)
update the given frequency statistic, taking note that an event occurred (and recalculating all frequencies)
|
public static final String PROP_STAT_FULL
public StatManager(I2PAppContext context)
public void addRateData(String name, long data)
public void addRateData(String name, long data, long eventDuration)
public void coalesceStats()
public void createFrequencyStat(String name, String description, String group, long[] periods)
name - unique name of the statisticdescription - simple description of the statisticgroup - used to group statistics togetherperiods - array of period lengths (in milliseconds)public void createRateStat(String name, String description, String group, long[] periods)
name - unique name of the statisticdescription - simple description of the statisticgroup - used to group statistics togetherperiods - array of period lengths (in milliseconds)public void createRequiredFrequencyStat(String name, String description, String group, long[] periods)
name - unique name of the statisticdescription - simple description of the statisticgroup - used to group statistics togetherperiods - array of period lengths (in milliseconds)public void createRequiredRateStat(String name, String description, String group, long[] periods)
name - unique name of the statisticdescription - simple description of the statisticgroup - used to group statistics togetherperiods - array of period lengths (in milliseconds)public FrequencyStat getFrequency(String name)
public Set<String> getFrequencyNames()
public Set<String> getRateNames()
public Map<String,SortedSet<String>> getStatsByGroup()
public boolean ignoreStat(String statName)
statName - ignoredpublic boolean isFrequency(String statName)
public boolean isRate(String statName)
public void removeRateStat(String name)
public void shutdown()
public void store(OutputStream out, String prefix) throws IOException
out - to write toprefix - to use when serializingIOException - if something goes wrongpublic void updateFrequency(String name)