lkml.org 
[lkml]   [2010]   [Oct]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v3] Add generic exponentially weighted moving average (EWMA) function
Date
On Thu October 21 2010 19:31:47 KOSAKI Motohiro wrote:
> Hi
>
> I'm plaing this a bit and I have to say this doesn't works as I expected
> because ewma_init() has very easy confusable.
>
> so, I have one request.
>
> > +/**
> > + * ewma_init() - Initialize EWMA parameters
> > + * @avg: Average structure
> > + * @factor: Factor to use for the scaled up internal value. The maximum
> > value + * of averages can be UINT_MAX/(factor*weight).
> > + * @weight: Exponential weight, or decay rate. This defines how fast the
> > + * influence of older values decreases. Has to be bigger than 1.
> > + *
> > + * Initialize the EWMA parameters for a given struct ewma @avg.
> > + */
> > +struct ewma*
> > +ewma_init(struct ewma *avg, const unsigned int factor,
> > + const unsigned int weight)
> > +{
> > + WARN_ON(weight <= 1 || factor == 0);
> > + avg->weight = weight;
> > + avg->factor = factor;
> > + return avg;
> > +}
> > +EXPORT_SYMBOL(ewma_init);
>
> Please initalize avg->internal too.

Oh, sorry! I forgot that!

> and nit, I don't understand what you intend by 'const unsigned int'. I
> think we can remove this const safely. it's more easy readable.

O.K. Will resend.

Apart from that, what didn't work as you expected?

Bruno


\
 
 \ /
  Last update: 2010-10-22 02:55    [W:0.101 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site