diff options
Diffstat (limited to 'tools/perf/builtin-stat.c')
-rw-r--r-- | tools/perf/builtin-stat.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 3db31e7bf173..c37368343fff 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -125,6 +125,7 @@ struct stats event_res_stats[MAX_COUNTERS][3]; | |||
125 | struct stats runtime_nsecs_stats; | 125 | struct stats runtime_nsecs_stats; |
126 | struct stats walltime_nsecs_stats; | 126 | struct stats walltime_nsecs_stats; |
127 | struct stats runtime_cycles_stats; | 127 | struct stats runtime_cycles_stats; |
128 | struct stats runtime_branches_stats; | ||
128 | 129 | ||
129 | #define MATCH_EVENT(t, c, counter) \ | 130 | #define MATCH_EVENT(t, c, counter) \ |
130 | (attrs[counter].type == PERF_TYPE_##t && \ | 131 | (attrs[counter].type == PERF_TYPE_##t && \ |
@@ -235,6 +236,8 @@ static void read_counter(int counter) | |||
235 | update_stats(&runtime_nsecs_stats, count[0]); | 236 | update_stats(&runtime_nsecs_stats, count[0]); |
236 | if (MATCH_EVENT(HARDWARE, HW_CPU_CYCLES, counter)) | 237 | if (MATCH_EVENT(HARDWARE, HW_CPU_CYCLES, counter)) |
237 | update_stats(&runtime_cycles_stats, count[0]); | 238 | update_stats(&runtime_cycles_stats, count[0]); |
239 | if (MATCH_EVENT(HARDWARE, HW_BRANCH_INSTRUCTIONS, counter)) | ||
240 | update_stats(&runtime_branches_stats, count[0]); | ||
238 | } | 241 | } |
239 | 242 | ||
240 | static int run_perf_stat(int argc __used, const char **argv) | 243 | static int run_perf_stat(int argc __used, const char **argv) |
@@ -352,6 +355,14 @@ static void abs_printout(int counter, double avg) | |||
352 | ratio = avg / total; | 355 | ratio = avg / total; |
353 | 356 | ||
354 | fprintf(stderr, " # %10.3f IPC ", ratio); | 357 | fprintf(stderr, " # %10.3f IPC ", ratio); |
358 | } else if (MATCH_EVENT(HARDWARE, HW_BRANCH_MISSES, counter)) { | ||
359 | total = avg_stats(&runtime_branches_stats); | ||
360 | |||
361 | if (total) | ||
362 | ratio = avg * 100 / total; | ||
363 | |||
364 | fprintf(stderr, " # %10.3f %% ", ratio); | ||
365 | |||
355 | } else { | 366 | } else { |
356 | total = avg_stats(&runtime_nsecs_stats); | 367 | total = avg_stats(&runtime_nsecs_stats); |
357 | 368 | ||