niteshnarayanlal
niteshnarayanlal

Reputation: 563

Comparing multiple perf reports

I am using Perf tool for profiling. I need to compare multiple reports generated from perf record command. I couldn't find any option in perf to do so, is there a way for it or manual interpretation is the only way?

Upvotes: 2

Views: 1738

Answers (2)

muser
muser

Reputation: 185

Differential flame graphs is a nice visual method.

Collect profile 1:

# perf record -F 99 -a -g -- sleep 30
# perf script > out.stacks1

Some time later (or after a code change), collect profile 2:

# perf record -F 99 -a -g -- sleep 30
# perf script > out.stacks2

Now fold these profile files, and generate a differential flame graph:

$ git clone --depth 1 http://github.com/brendangregg/FlameGraph
$ cd FlameGraph
$ ./stackcollapse-perf.pl ../out.stacks1 > out.folded1
$ ./stackcollapse-perf.pl ../out.stacks2 > out.folded2
$ ./difffolded.pl out.folded1 out.folded2 | ./flamegraph.pl > diff2.svg

Upvotes: 0

Artur Gainullin
Artur Gainullin

Reputation: 41

You can use perf diff for this purpose: perf diff [oldfile] [newfile]

Link to man page: https://linux.die.net/man/1/perf-diff

Upvotes: 4

Related Questions