Number of samples needs to be greater 1 to have a variance. Fixes nan% in perf-kvm-live output.
Signed-off-by: David Ahern <dsah...@gmail.com> Cc: Arnaldo Carvalho de Melo <a...@ghostprotocols.net> Cc: Ingo Molnar <mi...@kernel.org> Cc: Frederic Weisbecker <fweis...@gmail.com> Cc: Peter Zijlstra <pet...@infradead.org> Cc: Jiri Olsa <jo...@redhat.com> Cc: Namhyung Kim <namhy...@kernel.org> Cc: Xiao Guangrong <xiaoguangr...@linux.vnet.ibm.com> Cc: Runzhen Wang <runz...@linux.vnet.ibm.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); -- 1.7.10.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/