Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147701
b: refs/heads/master
c: e779898
h: refs/heads/master
i:
  147699: 0774f54
v: v3
  • Loading branch information
Ingo Molnar committed Jun 7, 2009
1 parent 2fe5f92 commit a61d0bd
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: a14832ff977e78d1982cdf78cdabb1f2320d9ac8
refs/heads/master: e779898aa74cd2e97216368b3f3689ceffe8aeed
11 changes: 11 additions & 0 deletions trunk/tools/perf/builtin-stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ static __u64 event_scaled[MAX_COUNTERS];

static __u64 runtime_nsecs;
static __u64 walltime_nsecs;
static __u64 runtime_cycles;

static void create_perf_stat_counter(int counter)
{
Expand Down Expand Up @@ -177,6 +178,9 @@ static void read_counter(int counter)
if (attrs[counter].type == PERF_TYPE_SOFTWARE &&
attrs[counter].config == PERF_COUNT_TASK_CLOCK)
runtime_nsecs = count[0];
if (attrs[counter].type == PERF_TYPE_HARDWARE &&
attrs[counter].config == PERF_COUNT_CPU_CYCLES)
runtime_cycles = count[0];
}

/*
Expand Down Expand Up @@ -214,6 +218,13 @@ static void print_counter(int counter)
if (runtime_nsecs)
fprintf(stderr, " # %11.3f M/sec",
(double)count[0]/runtime_nsecs*1000.0);
if (runtime_cycles &&
attrs[counter].type == PERF_TYPE_HARDWARE &&
attrs[counter].config == PERF_COUNT_INSTRUCTIONS) {

fprintf(stderr, " # %1.3f per cycle",
(double)count[0] / (double)runtime_cycles);
}
}
if (scaled)
fprintf(stderr, " (scaled from %.2f%%)",
Expand Down

0 comments on commit a61d0bd

Please sign in to comment.