net.i2p.stat
Class Frequency

java.lang.Object
  extended by net.i2p.stat.Frequency

public class Frequency
extends java.lang.Object

Manage the calculation of a moving event frequency over a certain period.


Constructor Summary
Frequency(long period)
           
 
Method Summary
 void eventOccurred()
          Take note that a new event occurred, recalculating all the averages and frequencies
 double getAverageEventsPerPeriod()
          calculate how many events would occur in a period given the current average
 double getAverageInterval()
          on average over the last $period, after how many milliseconds are events coming in, as calculated during the last event occurrence?
 long getEventCount()
          how many events have occurred within the lifetime of this stat?
 long getLastEvent()
          when did the last event occur?
 double getMaxAverageEventsPerPeriod()
          calculate how many events would occur in a period given the maximum average
 double getMinAverageInterval()
          what is the lowest average interval (aka most frequent) we have seen?
 long getPeriod()
          how long is this frequency averaged over?
 double getStrictAverageEventsPerPeriod()
          using the strict average interval, how many events occur within an average period?
 double getStrictAverageInterval()
          over the lifetime of this stat, without any decay or weighting, what was the average interval between events?
 void recalculate()
          Recalculate the averages
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Frequency

public Frequency(long period)
Method Detail

getPeriod

public long getPeriod()
how long is this frequency averaged over?


getLastEvent

public long getLastEvent()
when did the last event occur?


getAverageInterval

public double getAverageInterval()
on average over the last $period, after how many milliseconds are events coming in, as calculated during the last event occurrence?


getMinAverageInterval

public double getMinAverageInterval()
what is the lowest average interval (aka most frequent) we have seen?


getAverageEventsPerPeriod

public double getAverageEventsPerPeriod()
calculate how many events would occur in a period given the current average


getMaxAverageEventsPerPeriod

public double getMaxAverageEventsPerPeriod()
calculate how many events would occur in a period given the maximum average


getStrictAverageInterval

public double getStrictAverageInterval()
over the lifetime of this stat, without any decay or weighting, what was the average interval between events?


getStrictAverageEventsPerPeriod

public double getStrictAverageEventsPerPeriod()
using the strict average interval, how many events occur within an average period?


getEventCount

public long getEventCount()
how many events have occurred within the lifetime of this stat?


eventOccurred

public void eventOccurred()
Take note that a new event occurred, recalculating all the averages and frequencies


recalculate

public void recalculate()
Recalculate the averages