Hello All, How can I keep track of the different basic blocks of a program executed over time? Or in other words, how can I annotate the block name (block_a) and the time/cycle at which that blocs (block_a) was executed, and do this for all the blocks on a reasonable simple program? Regards, Raul. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161028/26350d6d/attachment.html>
Jonas Wagner via llvm-dev
2016-Oct-29 12:29 UTC
[llvm-dev] Basic block execution over time
Hi, I believe the easiest way to do this is using the new `trace_pc` functionality from SanitizerCoverage. See http://clang.llvm.org/docs/SanitizerCoverage.html#tracing-pcs for some documentation about that. In short: - Compile your program with the `-fsanitize-coverage=trace-pc` flag. - This adds a call to a function called `__sanitizer_cov_trace_pc` to every edge in the control-flow graph. - You can define this function in any way you want (just write C code, and link it to the application) - In particular, you can use `__builtin_return_address` to find where the function was called from. You're then free to dump that address to a file descriptor, store it in a memory buffer, ... Cheers, Jonas On Fri, Oct 28, 2016 at 5:20 PM Raul Garcia via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hello All, > > How can I keep track of the different basic blocks of a program executed > over time? > Or in other words, how can I annotate the block name (block_a) and the > time/cycle at which that blocs (block_a) was executed, and do this for all > the blocks on a reasonable simple program? > > Regards, Raul. > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161029/bc7d5bd2/attachment.html>
Dean Michael Berris via llvm-dev
2016-Nov-02 14:05 UTC
[llvm-dev] Basic block execution over time
The other option might be to see whether you could use XRay, but that might not give you basic blocks (though it will give you cycle time, thread, and function entry/exit points). The tooling for analysing the XRay trace files is under development and we're still lacking documentation -- but if you're interested I'd be happy to describe how to use it. Cheers -- Dean> On 29 Oct. 2016, at 23:29, Jonas Wagner via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hi, > > I believe the easiest way to do this is using the new `trace_pc` functionality from SanitizerCoverage. See http://clang.llvm.org/docs/SanitizerCoverage.html#tracing-pcs for some documentation about that. > > In short: > > - Compile your program with the `-fsanitize-coverage=trace-pc` flag. > - This adds a call to a function called `__sanitizer_cov_trace_pc` to every edge in the control-flow graph. > - You can define this function in any way you want (just write C code, and link it to the application) > - In particular, you can use `__builtin_return_address` to find where the function was called from. You're then free to dump that address to a file descriptor, store it in a memory buffer, ... > > Cheers, > Jonas > > On Fri, Oct 28, 2016 at 5:20 PM Raul Garcia via llvm-dev <llvm-dev at lists.llvm.org> wrote: > Hello All, > > How can I keep track of the different basic blocks of a program executed over time? > Or in other words, how can I annotate the block name (block_a) and the time/cycle at which that blocs (block_a) was executed, and do this for all the blocks on a reasonable simple program? > > Regards, Raul. > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev