From owner-svn-src-vendor@freebsd.org Fri Jun 9 15:04:11 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B9BDFBF6C26; Fri, 9 Jun 2017 15:04:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8763D6F7E3; Fri, 9 Jun 2017 15:04:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v59F4Aqn031475; Fri, 9 Jun 2017 15:04:10 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v59F4AJd031474; Fri, 9 Jun 2017 15:04:10 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201706091504.v59F4AJd031474@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 9 Jun 2017 15:04:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r319744 - vendor/illumos/dist/lib/libdtrace/common X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jun 2017 15:04:11 -0000 Author: avg Date: Fri Jun 9 15:04:10 2017 New Revision: 319744 URL: https://svnweb.freebsd.org/changeset/base/319744 Log: 8269 dtrace stddev aggregation is normalized incorrectly illumos/illumos-gate@79809f9cf402f130667349b2d4007ecd65d63c6f https://github.com/illumos/illumos-gate/commit/79809f9cf402f130667349b2d4007ecd65d63c6f https://www.illumos.org/issues/8269 It seems that currently normalization of stddev aggregation is done incorrectly. We divide both the sum of values and the sum of their squares by the normalization factor. But we should divide the sum of squares by the normalization factor squared to scale the original values properly. Reviewed by: Bryan Cantrill Approved by: Robert Mustacchi Author: Andriy Gapon Modified: vendor/illumos/dist/lib/libdtrace/common/dt_consume.c Modified: vendor/illumos/dist/lib/libdtrace/common/dt_consume.c ============================================================================== --- vendor/illumos/dist/lib/libdtrace/common/dt_consume.c Fri Jun 9 15:03:07 2017 (r319743) +++ vendor/illumos/dist/lib/libdtrace/common/dt_consume.c Fri Jun 9 15:04:10 2017 (r319744) @@ -381,8 +381,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];