Can perf-stat results be generated from a perf.data file?

linux, perf, performance, performancecounter, profiling

Solution

I dug into the source on kernel.org and it looks like there's no way to get perf stat to parse perf.data

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=blob;f=tools/perf/builtin-stat.c;h=c70d72003557f17f29345b0f219dc5ca9f572d75;hb=refs/heads/linux-2.6.33.y

If you look at line 245 you'll see the function "run_perf_stat" and the lines around 308-320 seem to be what actually do the recording and collating.

I didn't dig into this hard enough to determine if it's possible to enable the kind of functionality that you desire.

It does not look like perf report has a lot of additional formatting capabilities to it. You can check further if you like here:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=blob;f=tools/perf/builtin-report.c;h=860f1eeeea7dbf8e43779308eaaffb1dbcf79d10;hb=refs/heads/linux-2.6.33.y

Problem

When I want to generate performance reports using perf-stat and perf-report from the Linux tool suite perf, I run: ``` $ perf record -o my.perf.data myCmd $ perf report -i my.perf.data ``` And: ``` $ perf stat myCmd ``` But that means I run 'myCmd' a second time, which takes several minutes. Instead, I was hoping for: ``` $ perf stat -i my.perf.data ``` But unlike most of the tools in the perf suite, I don't see a -i option for perf-stat. Is there another tool for this, or a way to get perf-report to generate similar output to perf-stat?

Original source