Package net.i2p.stat
Class RateStat
java.lang.Object
net.i2p.stat.RateStat
coordinate a moving rate over various periods
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddData(long value) Update all of the rates for the various periods with the given value.voidaddData(long value, long eventDuration) update all of the rates for the various periods with the given value.voidaddRate(long period) Deprecated.voidcoalesce all the statsbooleancontainsRate(long period) Tests if a rate with the provided period exists within this RateStat.booleandoublelonggetName()long[]getRate(long period) Returns rate with requested period if it exists, otherwise nullinthashCode()voidload(Properties props, String prefix, boolean treatAsCurrent) Load this rate stat from the properties, populating all of the rates contained underneath it.(package private) booleanvoidremoveRate(long period) Deprecated.voidsetStatLog(StatLog sl) Sets the default stat log for this RateStat.voidstore(OutputStream out, String prefix) Includes comment linesvoidstore(OutputStream out, String prefix, boolean addComments) toString()
- 
Field Details- 
_ratesactual rate objects for this statistic
 
- 
- 
Constructor Details- 
RateStat
 
- 
- 
Method Details- 
setStatLogSets the default stat log for this RateStat. Deprecated, unused, to be disabled in a future release.
- 
addDatapublic void addData(long value, long eventDuration) update all of the rates for the various periods with the given value.
- 
addDatapublic void addData(long value) Update all of the rates for the various periods with the given value. Zero duration.- Since:
- 0.8.10
 
- 
coalesceStatspublic void coalesceStats()coalesce all the stats
- 
getName
- 
getGroupName
- 
getDescription
- 
getPeriodspublic long[] getPeriods()
- 
getLifetimeAverageValuepublic double getLifetimeAverageValue()
- 
getLifetimeEventCountpublic long getLifetimeEventCount()
- 
getRateReturns rate with requested period if it exists, otherwise null- Parameters:
- period- ms
- Returns:
- the Rate
 
- 
addRateDeprecated.Adds a new rate with the requested period, provided that a rate with that period does not already exist.- Parameters:
- period- ms
- Since:
- 0.8.8
 
- 
removeRateDeprecated.If a rate with the provided period exists, remove it.- Parameters:
- period- ms
- Since:
- 0.8.8
 
- 
containsRatepublic boolean containsRate(long period) Tests if a rate with the provided period exists within this RateStat.- Parameters:
- period- ms
- Returns:
- true if exists
- Since:
- 0.8.8
 
- 
hashCodepublic int hashCode()
- 
toString
- 
equals
- 
nameGroupDescEquals
- 
storeIncludes comment lines- Throws:
- IOException
 
- 
store- Parameters:
- addComments- add comment lines to the output
- Throws:
- IOException
- Since:
- 0.9.41
 
- 
loadpublic void load(Properties props, String prefix, boolean treatAsCurrent) throws IllegalArgumentException Load this rate stat from the properties, populating all of the rates contained underneath it. The comes from the given prefix (e.g. if we are given the prefix "profile.dbIntroduction", a series of rates may be found underneath "profile.dbIntroduction.60s", "profile.dbIntroduction.60m", and "profile.dbIntroduction.24h"). This RateStat must already be created, with the specified rate entries constructued - this merely loads them with data.- Parameters:
- prefix- prefix to the property entries (should NOT end with a period)
- treatAsCurrent- if true, we'll treat the loaded data as if no time has elapsed since it was written out, but if it is false, we'll treat the data with as much freshness (or staleness) as appropriate.
- Throws:
- IllegalArgumentException- if the data was formatted incorrectly
 
 
-