[llvm-dev] Reining in profile instrumentation

Martin J. O'Riordan via llvm-dev llvm-dev at lists.llvm.org
Tue Dec 13 03:46:23 PST 2016


When either '-pg' or '-finstrument-functions' is used, the compiler inserts
the appropriate profiling hooks.  This happens prior to inlining, so the
hooks remain in place.

 

Normally this is fine, but with C++ and the heavy use of inline functions
and templates, there can be a vast number of trivial functions that are
normally optimised away; but with the instrumentation hooks present, this
does not happen and the code becomes severely larger and more expensive to
execute.  Also, because of this, the program being profiled does not even
approximately resemble the normal program with no profiling hooks, so the
data gathered is of little use.

 

My question is whether there are any mechanisms in LLVM to control what
functions get instrumented; for instance '#pragma's that can be added to the
code, especially headers, that can be used to disable the instrumentation of
large groups of functions.  Or an option to remove the instrumentation
during inlining?

 

But I really do need a way of preventing the instrumentation of large
numbers of functions is a simple way.

 

Thanks,

 

            MartinO

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161213/a0e6fa79/attachment.html>


More information about the llvm-dev mailing list