Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Apr 2017 15:31:04 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r316853 - head/cddl/contrib/opensolaris/lib/libdtrace/common
Message-ID:  <201704141531.v3EFV4EZ093447@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Fri Apr 14 15:31:04 2017
New Revision: 316853
URL: https://svnweb.freebsd.org/changeset/base/316853

Log:
  dtrace: fix normalization of stddev aggregation
  
  To be upstreamed.
  
  Discussed with:	Bryan Cantrill <bryancantrill@gmail.com>
  MFC after:	2 weeks
  Sponsored by:	Panzura

Modified:
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c	Fri Apr 14 15:22:00 2017	(r316852)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c	Fri Apr 14 15:31:04 2017	(r316853)
@@ -389,8 +389,10 @@ dt_stddev(uint64_t *data, uint64_t norma
 	 * 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];



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704141531.v3EFV4EZ093447>