Package net.i2p.stat
Class RateStat
java.lang.Object
net.i2p.stat.RateStat
coordinate a moving rate over various periods
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier 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.voidstore(OutputStream out, String prefix) Includes comment linesvoidstore(OutputStream out, String prefix, boolean addComments) toString()
-
Field Details
-
_rates
actual rate objects for this statistic
-
-
Constructor Details
-
RateStat
-
-
Method Details
-
addData
public void addData(long value, long eventDuration) update all of the rates for the various periods with the given value. -
addData
public void addData(long value) Update all of the rates for the various periods with the given value. Zero duration.- Since:
- 0.8.10
-
coalesceStats
public void coalesceStats()coalesce all the stats -
getName
-
getGroupName
-
getDescription
-
getPeriods
public long[] getPeriods() -
getLifetimeAverageValue
public double getLifetimeAverageValue() -
getLifetimeEventCount
public long getLifetimeEventCount() -
getRate
Returns rate with requested period if it exists, otherwise null- Parameters:
period- ms- Returns:
- the Rate
-
addRate
Deprecated.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
-
removeRate
Deprecated.If a rate with the provided period exists, remove it.- Parameters:
period- ms- Since:
- 0.8.8
-
containsRate
public 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
-
hashCode
public int hashCode() -
toString
-
equals
-
nameGroupDescEquals
-
store
Includes comment lines- Throws:
IOException
-
store
- Parameters:
addComments- add comment lines to the output- Throws:
IOException- Since:
- 0.9.41
-
load
public 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
-