[LLVMdev] Easiest way to collect dynamic Instruction execution counts?

Stephen Thomas stephen.warner.thomas at gmail.com
Thu May 28 06:08:04 PDT 2015


Hi,

I'd like a simple and fast way to collect the number of times each
Instruction was executed in a given run of the application. As far as I can
tell, there are a number of approaches I can take:

- Use PIN. This would require using DWARF debug info and Instruction debug
info to attempt to map instructions in the binary to instructions in the
bitcode; not 100% sure how accurate this will be.

- Use llvm-prof. Two questions here. First, I've seen on Stack Overflow
<https://stackoverflow.com/questions/14617067/collecting-llvm-edge-profiling-with-llvm-prof>
an option to `opt` called `--insert-edge-profiling`. However, that option
doesn't seem to be available in 3.6? Second, it appears that such profiling
only records execution counts at the Function level, not at the individual
Instruction level. Is that correct?

- Write a new tool similar to AddressSanitizer.
<http://clang.llvm.org/docs/AddressSanitizer.html> This may work, but seems
like overkill.

Is there an easier way to achieve my goal that I'm missing?

Thanks,
Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150528/2848ac08/attachment.html>


More information about the llvm-dev mailing list