static __u64 runtime_nsecs;
static __u64 walltime_nsecs;
+static __u64 runtime_cycles;
static void create_perf_stat_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];
}
/*
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%%)",