diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-stat.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 3a29041f8575..0de3a2002f49 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -157,6 +157,7 @@ static double stddev_stats(struct stats *stats) | |||
157 | struct stats runtime_nsecs_stats[MAX_NR_CPUS]; | 157 | struct stats runtime_nsecs_stats[MAX_NR_CPUS]; |
158 | struct stats runtime_cycles_stats[MAX_NR_CPUS]; | 158 | struct stats runtime_cycles_stats[MAX_NR_CPUS]; |
159 | struct stats runtime_branches_stats[MAX_NR_CPUS]; | 159 | struct stats runtime_branches_stats[MAX_NR_CPUS]; |
160 | struct stats runtime_cacherefs_stats[MAX_NR_CPUS]; | ||
160 | struct stats walltime_nsecs_stats; | 161 | struct stats walltime_nsecs_stats; |
161 | 162 | ||
162 | static int create_perf_stat_counter(struct perf_evsel *evsel) | 163 | static int create_perf_stat_counter(struct perf_evsel *evsel) |
@@ -219,10 +220,12 @@ static int read_counter_aggr(struct perf_evsel *counter) | |||
219 | */ | 220 | */ |
220 | if (perf_evsel__match(counter, SOFTWARE, SW_TASK_CLOCK)) | 221 | if (perf_evsel__match(counter, SOFTWARE, SW_TASK_CLOCK)) |
221 | update_stats(&runtime_nsecs_stats[0], count[0]); | 222 | update_stats(&runtime_nsecs_stats[0], count[0]); |
222 | if (perf_evsel__match(counter, HARDWARE, HW_CPU_CYCLES)) | 223 | else if (perf_evsel__match(counter, HARDWARE, HW_CPU_CYCLES)) |
223 | update_stats(&runtime_cycles_stats[0], count[0]); | 224 | update_stats(&runtime_cycles_stats[0], count[0]); |
224 | if (perf_evsel__match(counter, HARDWARE, HW_BRANCH_INSTRUCTIONS)) | 225 | else if (perf_evsel__match(counter, HARDWARE, HW_BRANCH_INSTRUCTIONS)) |
225 | update_stats(&runtime_branches_stats[0], count[0]); | 226 | update_stats(&runtime_branches_stats[0], count[0]); |
227 | else if (perf_evsel__match(counter, HARDWARE, HW_CACHE_REFERENCES)) | ||
228 | update_stats(&runtime_cacherefs_stats[0], count[0]); | ||
226 | 229 | ||
227 | return 0; | 230 | return 0; |
228 | } | 231 | } |
@@ -404,7 +407,7 @@ static void nsec_printout(int cpu, struct perf_evsel *evsel, double avg) | |||
404 | return; | 407 | return; |
405 | 408 | ||
406 | if (perf_evsel__match(evsel, SOFTWARE, SW_TASK_CLOCK)) | 409 | if (perf_evsel__match(evsel, SOFTWARE, SW_TASK_CLOCK)) |
407 | fprintf(stderr, " # %10.3f CPUs ", | 410 | fprintf(stderr, " # %10.3f CPUs", |
408 | avg / avg_stats(&walltime_nsecs_stats)); | 411 | avg / avg_stats(&walltime_nsecs_stats)); |
409 | } | 412 | } |
410 | 413 | ||
@@ -452,6 +455,15 @@ static void abs_printout(int cpu, struct perf_evsel *evsel, double avg) | |||
452 | 455 | ||
453 | fprintf(stderr, " # %10.3f %%", ratio); | 456 | fprintf(stderr, " # %10.3f %%", ratio); |
454 | 457 | ||
458 | } else if (perf_evsel__match(evsel, HARDWARE, HW_CACHE_MISSES) && | ||
459 | runtime_cacherefs_stats[cpu].n != 0) { | ||
460 | total = avg_stats(&runtime_cacherefs_stats[cpu]); | ||
461 | |||
462 | if (total) | ||
463 | ratio = avg * 100 / total; | ||
464 | |||
465 | fprintf(stderr, " # %10.3f %%", ratio); | ||
466 | |||
455 | } else if (runtime_nsecs_stats[cpu].n != 0) { | 467 | } else if (runtime_nsecs_stats[cpu].n != 0) { |
456 | total = avg_stats(&runtime_nsecs_stats[cpu]); | 468 | total = avg_stats(&runtime_nsecs_stats[cpu]); |
457 | 469 | ||