From: Felix Fietkau Date: Sun, 29 Mar 2009 02:12:47 +0000 (+0000) Subject: wprobe: fix moving average X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=9dc3c72f0d6b9ed0cc66e6eca44f442769057d4f;p=librecmc%2Flibrecmc.git wprobe: fix moving average SVN-Revision: 15064 --- diff --git a/package/wprobe/src/kernel/wprobe-core.c b/package/wprobe/src/kernel/wprobe-core.c index 03e9049464..798cd7ddec 100644 --- a/package/wprobe/src/kernel/wprobe-core.c +++ b/package/wprobe/src/kernel/wprobe-core.c @@ -448,10 +448,10 @@ wprobe_scale_stats(const struct wprobe_item *item, struct wprobe_value *val, int else if (wprobe_fam.attrbuf[WPROBE_ATTR_SCALE]) scale = nla_get_u32(wprobe_fam.attrbuf[WPROBE_ATTR_SCALE]); - if ((scale > 0) && (val[i].n >= scale)) { + if ((scale > 0) && (val[i].n > scale)) { val[i].s = div_s64(val[i].s, scale); val[i].ss = div_s64(val[i].ss, scale); - val[i].n /= scale; + val[i].n = val[i].n / scale + 1; } } }