in reply to Average over time

So I'm wondering, is there a method that I'm missing? Some way to calculate a running average over a given time period without having to keep all the values of that period in memory?
Aren't you already keeping a running average? If not, then what's the code following Squeeze out events that have timed out doing?

Abigail

Replies are listed 'Best First'.
Re: Re: Average over time
by matija (Priest) on Mar 24, 2004 at 16:20 UTC
    What I posted is one method of keeping a running average over the last (timeperiod). But it requires that I keep all the events in memory until they age out.

    I'm looking for a method that would dispense with that requirement. There may not be one for all I know, but I thought it was worth asking the other monks for ideas.

      If you needed to, you could aggregate individual entries into small blocks of time. For example, 5 second intervals instead of 1 second intervals. At the very least, if you've got multiple entries for any given second (since that seems to be the finest resolution you look at), you would want to store only the average for that second.

      The PerlMonk tr/// Advocate