Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 169515
b: refs/heads/master
c: 1101820
h: refs/heads/master
i:
  169513: a9476c4
  169511: f5839fd
v: v3
  • Loading branch information
Anton Blanchard authored and Ingo Molnar committed Oct 19, 2009
1 parent 5cfafa8 commit 1d8bbcb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f39cdf25bf77219676ec5360980ac40b1a7e144a
refs/heads/master: 11018201b831e19304c0d639f105ad6c27e120b1
11 changes: 11 additions & 0 deletions trunk/tools/perf/builtin-stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ struct stats event_res_stats[MAX_COUNTERS][3];
struct stats runtime_nsecs_stats;
struct stats walltime_nsecs_stats;
struct stats runtime_cycles_stats;
struct stats runtime_branches_stats;

#define MATCH_EVENT(t, c, counter) \
(attrs[counter].type == PERF_TYPE_##t && \
Expand Down Expand Up @@ -235,6 +236,8 @@ static void read_counter(int counter)
update_stats(&runtime_nsecs_stats, count[0]);
if (MATCH_EVENT(HARDWARE, HW_CPU_CYCLES, counter))
update_stats(&runtime_cycles_stats, count[0]);
if (MATCH_EVENT(HARDWARE, HW_BRANCH_INSTRUCTIONS, counter))
update_stats(&runtime_branches_stats, count[0]);
}

static int run_perf_stat(int argc __used, const char **argv)
Expand Down Expand Up @@ -352,6 +355,14 @@ static void abs_printout(int counter, double avg)
ratio = avg / total;

fprintf(stderr, " # %10.3f IPC ", ratio);
} else if (MATCH_EVENT(HARDWARE, HW_BRANCH_MISSES, counter)) {
total = avg_stats(&runtime_branches_stats);

if (total)
ratio = avg * 100 / total;

fprintf(stderr, " # %10.3f %% ", ratio);

} else {
total = avg_stats(&runtime_nsecs_stats);

Expand Down

0 comments on commit 1d8bbcb

Please sign in to comment.