aboutsummaryrefslogtreecommitdiff
path: root/cddl/contrib/opensolaris/lib/libdtrace
diff options
context:
space:
mode:
authorAndriy Gapon <avg@FreeBSD.org>2017-04-14 15:31:04 +0000
committerAndriy Gapon <avg@FreeBSD.org>2017-04-14 15:31:04 +0000
commit5ad79d9b2037c0676aab1c92f9f6ac7fb77c9a97 (patch)
treeb6e32aba0597c8d41b3ee8dcf787b66f2024ab48 /cddl/contrib/opensolaris/lib/libdtrace
parentf4247773faa2a6765a29ed04339d722998e28bd4 (diff)
downloadsrc-5ad79d9b2037c0676aab1c92f9f6ac7fb77c9a97.tar.gz
src-5ad79d9b2037c0676aab1c92f9f6ac7fb77c9a97.zip
dtrace: fix normalization of stddev aggregation
To be upstreamed. Discussed with: Bryan Cantrill <bryancantrill@gmail.com> MFC after: 2 weeks Sponsored by: Panzura
Notes
Notes: svn path=/head/; revision=316853
Diffstat (limited to 'cddl/contrib/opensolaris/lib/libdtrace')
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c
index de574a330268..62c120388b18 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c
@@ -389,8 +389,10 @@ dt_stddev(uint64_t *data, uint64_t normal)
* The standard approximation for standard deviation is
* sqrt(average(x**2) - average(x)**2), i.e. the square root
* of the average of the squares minus the square of the average.
+ * When normalizing, we should divide the sum of x**2 by normal**2.
*/
dt_divide_128(data + 2, normal, avg_of_squares);
+ dt_divide_128(avg_of_squares, normal, avg_of_squares);
dt_divide_128(avg_of_squares, data[0], avg_of_squares);
norm_avg = (int64_t)data[1] / (int64_t)normal / (int64_t)data[0];