QuantumBlack
QuantumBlack

Reputation: 1546

Use perf report taking symbols from a specific binary file

I'm collecting data with

perf record -o "filename.here" -a --call-graph dwarf -p `pidof binary.here`

And reading it with

perf report -i "filename.here"

However this stops working when my live binary gets changed/rebuilt (due to me constantly updating it since it's a work in progress) saying "binary with build id XXX cannot be found". I am saving the old binary for which I collected data but it seems there's no way for perf report to explicitly load a specific binary (there's the --symfs option but that's to look for ALL debug symbols there for all libraries/etc which is also not a solution).

One other solution would be to stop the live binary and copy paste the backed up binary instead of it, but I can't afford to stop the live binary just to do this. Another solution would be to copy the backed up binary on a different server so I can store it in the same path perf is trying to search for it.

Is there any actual better solution for this?

Upvotes: 2

Views: 3979

Answers (1)

Arnaldo Melo
Arnaldo Melo

Reputation: 81

That message:

binary with build id XXX cannot be found

Is there because perf record will, at the end of the recording phase, save a copy of the binaries with samples, so that if you later update it, no problem, that specific binary was saved under ~/.debug/.build/id/AA/BBCCDDEEFF001122 and that is what perf report and other consumers will lookup.

Then this is a matter of figuring out why that build id is not being found. Are you using both 'perf record' and 'perf report' in the same machine?

Also what:

perf buildid-list -i filename.here

Says?

Look at your ~/.debug/ directory for that file.

perf buildid-list -i /path/to/binary

will tell you the buildid for a binary.

Upvotes: 5

Related Questions