aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-stat.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 924d18c407b8..845ded8f15a2 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -382,6 +382,16 @@ static int run_perf_stat(int argc __used, const char **argv)
382 return WEXITSTATUS(status); 382 return WEXITSTATUS(status);
383} 383}
384 384
385static void print_noise_pct(double total, double avg)
386{
387 double pct = 0.0;
388
389 if (avg)
390 pct = 100.0*total/avg;
391
392 fprintf(stderr, " ( +-%6.2f%% )", pct);
393}
394
385static void print_noise(struct perf_evsel *evsel, double avg) 395static void print_noise(struct perf_evsel *evsel, double avg)
386{ 396{
387 struct perf_stat *ps; 397 struct perf_stat *ps;
@@ -390,8 +400,7 @@ static void print_noise(struct perf_evsel *evsel, double avg)
390 return; 400 return;
391 401
392 ps = evsel->priv; 402 ps = evsel->priv;
393 fprintf(stderr, " ( +- %7.3f%% )", 403 print_noise_pct(stddev_stats(&ps->res_stats[0]), avg);
394 100 * stddev_stats(&ps->res_stats[0]) / avg);
395} 404}
396 405
397static void nsec_printout(int cpu, struct perf_evsel *evsel, double avg) 406static void nsec_printout(int cpu, struct perf_evsel *evsel, double avg)
@@ -635,9 +644,8 @@ static void print_stat(int argc, const char **argv)
635 fprintf(stderr, " %18.9f seconds time elapsed", 644 fprintf(stderr, " %18.9f seconds time elapsed",
636 avg_stats(&walltime_nsecs_stats)/1e9); 645 avg_stats(&walltime_nsecs_stats)/1e9);
637 if (run_count > 1) { 646 if (run_count > 1) {
638 fprintf(stderr, " ( +-%5.2f%% )", 647 print_noise_pct(stddev_stats(&walltime_nsecs_stats),
639 100*stddev_stats(&walltime_nsecs_stats) / 648 avg_stats(&walltime_nsecs_stats));
640 avg_stats(&walltime_nsecs_stats));
641 } 649 }
642 fprintf(stderr, "\n\n"); 650 fprintf(stderr, "\n\n");
643 } 651 }