Package net.i2p.stat
Class Frequency
- java.lang.Object
- 
- net.i2p.stat.Frequency
 
- 
 public class Frequency extends Object Manage the calculation of a moving average event frequency over a certain period. This provides lifetime, and rolling average, frequency counts. Unlike Rate, it does not support "bucketed" averages. There is no tracking of the event frequency in the current or last bucket. There are no buckets at all. Depending on what you want, a rolling average might be better than buckets. Or not.
- 
- 
Constructor SummaryConstructors Constructor Description Frequency(long period)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voideventOccurred()Take note that a new event occurred, recalculating all the averages and frequenciesdoublegetAverageEventsPerPeriod()Calculate how many events would occur in a period given the current (rolling) average.doublegetAverageInterval()on average over the last $period, after how many milliseconds are events coming in, as calculated during the last event occurrence?longgetEventCount()how many events have occurred within the lifetime of this stat?longgetLastEvent()Deprecated.unuseddoublegetMaxAverageEventsPerPeriod()Calculate how many events would occur in a period given the maximum rolling average.doublegetMinAverageInterval()Deprecated.unusedlonggetPeriod()how long is this frequency averaged over? (ms)doublegetStrictAverageEventsPerPeriod()using the strict average interval, how many events occur within an average period?doublegetStrictAverageInterval()Over the lifetime of this stat, without any decay or weighting, what was the average interval between events? (ms)voidrecalculate()Recalculate the averages(package private) voidstore(StringBuilder dest)Appends the data of this frequency to the specified StringBuilder
 
- 
- 
- 
Method Detail- 
getPeriodpublic long getPeriod() how long is this frequency averaged over? (ms)
 - 
getLastEvent@Deprecated public long getLastEvent() Deprecated.unusedwhen did the last event occur?
 - 
getAverageIntervalpublic double getAverageInterval() on average over the last $period, after how many milliseconds are events coming in, as calculated during the last event occurrence?- Returns:
- milliseconds; returns period + 1 if no events in previous period
 
 - 
getMinAverageInterval@Deprecated public double getMinAverageInterval() Deprecated.unusedwhat is the lowest average interval (aka most frequent) we have seen? (ms)- Returns:
- milliseconds; returns period + 1 if no events in previous period
 
 - 
getAverageEventsPerPeriodpublic double getAverageEventsPerPeriod() Calculate how many events would occur in a period given the current (rolling) average. Use getStrictAverageInterval() for the real lifetime average.
 - 
getMaxAverageEventsPerPeriodpublic double getMaxAverageEventsPerPeriod() Calculate how many events would occur in a period given the maximum rolling average. Use getStrictAverageEventsPerPeriod() for the real lifetime average.
 - 
getStrictAverageIntervalpublic double getStrictAverageInterval() Over the lifetime of this stat, without any decay or weighting, what was the average interval between events? (ms)- Returns:
- milliseconds; returns Double.MAX_VALUE if no events ever
 
 - 
getStrictAverageEventsPerPeriodpublic double getStrictAverageEventsPerPeriod() using the strict average interval, how many events occur within an average period?
 - 
getEventCountpublic long getEventCount() how many events have occurred within the lifetime of this stat?
 - 
eventOccurredpublic void eventOccurred() Take note that a new event occurred, recalculating all the averages and frequencies
 - 
recalculatepublic void recalculate() Recalculate the averages
 - 
storevoid store(StringBuilder dest) Appends the data of this frequency to the specified StringBuilder- Parameters:
- dest- to append data to
- Since:
- 0.9.23
 
 
- 
 
-