perf stat: Change noise calculation to use stddev
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Fri, 4 Sep 2009 13:36:12 +0000 (15:36 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 24 Sep 2009 15:44:00 +0000 (08:44 -0700)
commit4da07ab56e64e4b022e03b1a9b602d68e390cf1a
tree1a3a271d4f37eeeac7060d3704179b9b3d7024d8
parent0dadca5c16ebc1754b14cd6db3710ddab3c68f7d
perf stat: Change noise calculation to use stddev

commit 506d4bc8d5dab20d84624aa07cdc6dcd77915d52 upstream.

The current noise computation does:

 \Sum abs(n_i - avg(n)) * N^-1.5

Which is (afaik) not a regular noise function, and needs the
complete sample set available to post-process.

Change this to use a regular stddev computation which can be
done by keeping a two sums:

 stddev = sqrt( 1/N (\Sum n_i^2) - avg(n)^2 )

For which we only need to keep \Sum n_i and \Sum n_i^2.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: <stable@kernel.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
tools/perf/builtin-stat.c