java.lang.Object
net.i2p.stat.FrequencyStat
Coordinates an event frequency over various periods.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StringDescribes the stat.private final Frequency[]Actual frequency objects for this statistic.private final StringGrouping under which the stat is kept.private final StringUnique name of the statistic.private static final StringLine separator of the persisted file.Constructor Summary
ConstructorsConstructorDescriptionFrequencyStat(String name, String description, String group, long[] periods) Create a new frequency stat.Method Summary
All MethodsModifier and TypeMethodDescriptionvoidCoalesce all the stats.booleanCompares this frequency stat to another object for equality.voidUpdates all of the frequencies for the various periods.Description of what this statistic measures.longTotal number of events recorded.longLifetime average frequency.getFrequency(long period) Frequency object for the specified period.Grouping name for this statistic.getName()Unique name for this statistic.long[]Tracked periods for this frequency stat.inthashCode()voidstore(OutputStream out, String prefix) Serializes this FrequencyStat to the provided OutputStream.
Field Details
_statName
Unique name of the statistic._groupName
Grouping under which the stat is kept._description
Describes the stat._frequencies
Actual frequency objects for this statistic.NL
Line separator of the persisted file.
Constructor Details
FrequencyStat
Method Details
eventOccurred
public void eventOccurred()Updates all of the frequencies for the various periods.coalesceStats
public void coalesceStats()Coalesce all the stats.getName
getGroupName
Grouping name for this statistic.- Returns:
- the grouping name under which this statistic is kept
getDescription
Description of what this statistic measures.- Returns:
- a simple description of this statistic
getPeriods
public long[] getPeriods()Tracked periods for this frequency stat.- Returns:
- the periods this frequency is tracked over, in milliseconds
getFrequency
Frequency object for the specified period.- Parameters:
period- the period in milliseconds- Returns:
- the Frequency for the given period, or null if not found
getEventCount
public long getEventCount()Total number of events recorded.- Returns:
- the count over the lifetime period, or 0 if no periods are defined
getFrequency
public long getFrequency()Lifetime average frequency.- Returns:
- lifetime average frequency in millisedonds, i.e. the average time between events, or Long.MAX_VALUE if no events ever
hashCode
equals
store
Serializes this FrequencyStat to the provided OutputStream.- Parameters:
out- to write toprefix- to prepend to the stat- Throws:
IOException- if something goes wrong