summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2009-03-29 02:12:47 +0000
committerFelix Fietkau <nbd@openwrt.org>2009-03-29 02:12:47 +0000
commit9dc3c72f0d6b9ed0cc66e6eca44f442769057d4f (patch)
tree8b8b4e121a5b403b67cc99526a5dc044fc77e578
parentab55cf802df12362ec9481e6921a8a825baf0bd2 (diff)
downloadmtk-20170518-9dc3c72f0d6b9ed0cc66e6eca44f442769057d4f.zip
mtk-20170518-9dc3c72f0d6b9ed0cc66e6eca44f442769057d4f.tar.gz
mtk-20170518-9dc3c72f0d6b9ed0cc66e6eca44f442769057d4f.tar.bz2
wprobe: fix moving average
SVN-Revision: 15064
-rw-r--r--package/wprobe/src/kernel/wprobe-core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/package/wprobe/src/kernel/wprobe-core.c b/package/wprobe/src/kernel/wprobe-core.c
index 03e9049..798cd7d 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;
}
}
}