Package net.i2p.stat
Class StatManager
java.lang.Object
net.i2p.stat.StatManager
Coordinate the management of various frequencies and rates within I2P components,
 both allowing central update and retrieval, as well as distributed creation and 
 use.  This does not provide any persistence, but the data structures exposed can be
 read and updated to manage the complete state.
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionStatManager(I2PAppContext context) The stat manager should only be constructed and accessed through the application context.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddRateData(String name, long data) Update the given rate statistic, taking note that the given data point was received (and recalculating all rates).voidaddRateData(String name, long data, long eventDuration) update the given rate statistic, taking note that the given data point was received (and recalculating all rates)voidvoidcreateFrequencyStat(String name, String description, String group, long[] periods) Create a new statistic to monitor the frequency of some event.voidcreateRateStat(String name, String description, String group, long[] periods) Create a new statistic to monitor the average value and confidence of some action.voidcreateRequiredFrequencyStat(String name, String description, String group, long[] periods) Create a new statistic to monitor the frequency of some event.voidcreateRequiredRateStat(String name, String description, String group, long[] periods) Create a new statistic to monitor the average value and confidence of some action.getFrequency(String name) Misnamed, as it returns a FrequencyStat, not a Frequency.Misnamed, as it returns a RateStat, not a Rate.Gets the default stat log for RateStats Deprecated, unusedGroup name (untranslated String) to a SortedSet of untranslated stat names.booleanignoreStat(String statName) Save memory by not creating stats unless they are required for router operation.booleanisFrequency(String statName) is the given stat a monitored frequency?booleanis the given stat a monitored rate?voidremoveRateStat(String name) voidsetStatLog(StatLog log) Deprecated.unusedvoidshutdown()voidstore(OutputStream out, String prefix) Serializes all Frequencies and Rates to the provided OutputStreamvoidupdateFrequency(String name) update the given frequency statistic, taking note that an event occurred (and recalculating all frequencies)
- 
Field Details- 
PROP_STAT_FILTERComma-separated stats or * for all. This property must be set at startup, or logging is disabled.- See Also:
 
- 
PROP_STAT_FILE- See Also:
 
- 
DEFAULT_STAT_FILE- See Also:
 
- 
PROP_STAT_FULLdefault false- See Also:
 
 
- 
- 
Constructor Details- 
StatManagerThe stat manager should only be constructed and accessed through the application context. This constructor should only be used by the appropriate application context itself.
 
- 
- 
Method Details- 
shutdownpublic void shutdown()- Since:
- 0.8.8
 
- 
getStatLogGets the default stat log for RateStats Deprecated, unused- Returns:
- null always
 
- 
setStatLogDeprecated.unusedSets the default stat log for ALL known RateStats. Deprecated, unused
- 
createFrequencyStatCreate a new statistic to monitor the frequency of some event. The stat is ONLY created if the stat.full property is true or we are not in the router context.- Parameters:
- name- unique name of the statistic
- description- simple description of the statistic
- group- used to group statistics together
- periods- array of period lengths (in milliseconds)
 
- 
createRequiredFrequencyStatpublic void createRequiredFrequencyStat(String name, String description, String group, long[] periods) Create a new statistic to monitor the frequency of some event. The stat is always created, independent of the stat.full setting or context.- Parameters:
- name- unique name of the statistic
- description- simple description of the statistic
- group- used to group statistics together
- periods- array of period lengths (in milliseconds)
- Since:
- 0.8.7
 
- 
createRateStatCreate a new statistic to monitor the average value and confidence of some action. The stat is ONLY created if the stat.full property is true or we are not in the router context.- Parameters:
- name- unique name of the statistic
- description- simple description of the statistic
- group- used to group statistics together
- periods- array of period lengths (in milliseconds)
 
- 
createRequiredRateStatCreate a new statistic to monitor the average value and confidence of some action. The stat is always created, independent of the stat.full setting or context.- Parameters:
- name- unique name of the statistic
- description- simple description of the statistic
- group- used to group statistics together
- periods- array of period lengths (in milliseconds)
- Since:
- 0.8.7
 
- 
removeRateStat
- 
updateFrequencyupdate the given frequency statistic, taking note that an event occurred (and recalculating all frequencies)
- 
addRateDataupdate the given rate statistic, taking note that the given data point was received (and recalculating all rates)
- 
addRateDataUpdate the given rate statistic, taking note that the given data point was received (and recalculating all rates). Zero duration.- Since:
- 0.8.10
 
- 
coalesceStatspublic void coalesceStats()
- 
getFrequencyMisnamed, as it returns a FrequencyStat, not a Frequency.
- 
getRateMisnamed, as it returns a RateStat, not a Rate.
- 
getFrequencyNames- Returns:
- a copy
 
- 
getRateNames- Returns:
- a copy
 
- 
isRateis the given stat a monitored rate?
- 
isFrequencyis the given stat a monitored frequency?
- 
getStatsByGroupGroup name (untranslated String) to a SortedSet of untranslated stat names. Map is unsorted.
- 
getStatFilter
- 
getStatFile
- 
ignoreStatSave memory by not creating stats unless they are required for router operation. For backward compatibility of any external clients, always returns false if not in router context.- Parameters:
- statName- ignored
- Returns:
- true if the stat should be ignored.
 
- 
storeSerializes all Frequencies and Rates to the provided OutputStream- Parameters:
- out- to write to
- prefix- to use when serializing
- Throws:
- IOException- if something goes wrong
- Since:
- 0.9.23
 
 
-