[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-45528f7c699a71d2f3096173980aadd43dff6eaa@git.kernel.org>
Date: Fri, 31 May 2013 04:51:11 -0700
From: tip-bot for David Ahern <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: acme@...hat.com, linux-kernel@...r.kernel.org, hpa@...or.com,
mingo@...nel.org, peterz@...radead.org, namhyung@...nel.org,
runzhen@...ux.vnet.ibm.com, jolsa@...hat.com, fweisbec@...il.com,
xiaoguangrong@...ux.vnet.ibm.com, dsahern@...il.com,
tglx@...utronix.de
Subject: [tip:perf/core] perf stats: Fix divide by 0 in variance
Commit-ID: 45528f7c699a71d2f3096173980aadd43dff6eaa
Gitweb: http://git.kernel.org/tip/45528f7c699a71d2f3096173980aadd43dff6eaa
Author: David Ahern <dsahern@...il.com>
AuthorDate: Sat, 25 May 2013 18:24:48 -0600
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Tue, 28 May 2013 16:24:04 +0300
perf stats: Fix divide by 0 in variance
Number of samples needs to be greater 1 to have a variance.
Fixes nan% in perf-kvm-live output.
Signed-off-by: David Ahern <dsahern@...il.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: Ingo Molnar <mingo@...nel.org>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Runzhen Wang <runzhen@...ux.vnet.ibm.com>
Cc: Xiao Guangrong <xiaoguangrong@...ux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/1369527896-3650-9-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/stat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
index 2374212..7c59c28 100644
--- a/tools/perf/util/stat.c
+++ b/tools/perf/util/stat.c
@@ -37,7 +37,7 @@ double stddev_stats(struct stats *stats)
{
double variance, variance_mean;
- if (!stats->n)
+ if (stats->n < 2)
return 0.0;
variance = stats->M2 / (stats->n - 1);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists