Function Instrumentation profiling

This method provides you with precise function run time information for your project. It performs better on one thread, because with many threads, the overhead of such measurement can change the application's behavior.

To enable instrumentation, compile each source file with the option -finstrument-functions. This gcc option instructs the compiler to generate a call to the profiling function just after the entrance to, and just before the exit from every application function, which permits the collection of profiling information. Profiling functions are defined in the libprofilingS.a library; to access these, link the binary or library with the -lprofilingS option.


For an application that intends to use an instrumented library as a DLL (i.e. using a dlopen() call), compile the library and the binary with the -Wl,-E linker option.

Related concepts
Statistical sample profiling (sampling)
Sampling and Call Count instrumentation profiling
Postmortem profiling for Call Count and Function Instrumentation profiling