To use gprof, we pass -pg flag to GCC so some instrumentation code will be inserted into each functions. I'm curious about the possibility of inserting customized code into each function. For example, to measure the time of a critical path, I need to insert code manually into functions along the critical path, I want to make this process automatic. So my question is: Is it possible to insert customized code into each or selected functions using gcc/clang plugin?
2.1m questions
2.1m answers
60 comments
57.0k users