mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
perf stat: Fix -nan% output in perf stat noise printouts
Before:
0 CPU-migrations # 0.000 M/sec ( +- -nan% )
After:
0 CPU-migrations # 0.000 M/sec ( +- 0.00% )
Also factor out the noise printing function.
Acked-by: Peter Zijlstra <[email protected]>
Acked-by: Arnaldo Carvalho de Melo <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
parent
1fc570ad89
commit
f99844cb76
1 changed files with 13 additions and 5 deletions
|
|
@ -382,6 +382,16 @@ static int run_perf_stat(int argc __used, const char **argv)
|
|||
return WEXITSTATUS(status);
|
||||
}
|
||||
|
||||
static void print_noise_pct(double total, double avg)
|
||||
{
|
||||
double pct = 0.0;
|
||||
|
||||
if (avg)
|
||||
pct = 100.0*total/avg;
|
||||
|
||||
fprintf(stderr, " ( +-%6.2f%% )", pct);
|
||||
}
|
||||
|
||||
static void print_noise(struct perf_evsel *evsel, double avg)
|
||||
{
|
||||
struct perf_stat *ps;
|
||||
|
|
@ -390,8 +400,7 @@ static void print_noise(struct perf_evsel *evsel, double avg)
|
|||
return;
|
||||
|
||||
ps = evsel->priv;
|
||||
fprintf(stderr, " ( +- %7.3f%% )",
|
||||
100 * stddev_stats(&ps->res_stats[0]) / avg);
|
||||
print_noise_pct(stddev_stats(&ps->res_stats[0]), avg);
|
||||
}
|
||||
|
||||
static void nsec_printout(int cpu, struct perf_evsel *evsel, double avg)
|
||||
|
|
@ -635,9 +644,8 @@ static void print_stat(int argc, const char **argv)
|
|||
fprintf(stderr, " %18.9f seconds time elapsed",
|
||||
avg_stats(&walltime_nsecs_stats)/1e9);
|
||||
if (run_count > 1) {
|
||||
fprintf(stderr, " ( +-%5.2f%% )",
|
||||
100*stddev_stats(&walltime_nsecs_stats) /
|
||||
avg_stats(&walltime_nsecs_stats));
|
||||
print_noise_pct(stddev_stats(&walltime_nsecs_stats),
|
||||
avg_stats(&walltime_nsecs_stats));
|
||||
}
|
||||
fprintf(stderr, "\n\n");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue