Compiler-driven Subroutine Instrumentation

This topic describes the compiler-driven subroutine instrumentation.

Intel® Professional Edition Compilers 10.0 and later

The Intel® Professional Edition Compilers can automatically instrument functions during compilation. At runtime Intel® Trace Collector will record all function entries and exits in those compilation units. Compile time instrumentation is enabled with the option -tcollect (Linux* OS) or /Qtcollect (Microsoft* Windows* OS). The option accepts an argument to specify the collecting library to link against. For example, for non-MPI applications you can select libVTcs as follows: -tcollect=VTcs. The default value is VT. Before you use this option with the Intel compiler, set up Intel® Trace Collector through one of its set-up scripts. While for MPI applications, the initialization is done automatically; manual interaction is needed for non-MPI programs. In this case you must ensure that Intel® Trace Collector gets properly initialized through its API routines VT_initialize or VT_init.

By default, -tcollect instruments all functions in the application. To define a particular set of functions to be instrumented, use -tcollect-filter <file> option. <file> contains a list of functions followed by on|off switcher:

func1 on

func2 off

If a function is marked off, it will not be instrumented.

gcc/g++

Similar function tracing is possible through the GNU* compiler suite version 2.95.2 or later. Object files that contain functions to be traced are compiled with -finstrument-functions, for example:

mpicc -finstrument-functions -L${VT_ROOT}/slib -lVT app.c

VT should be able to obtain output about functions in the executable. By default this is done by starting the shell program nm -P, which can be changed with the NMCMD config option.

Folding

Function tracing can easily generate large amounts of trace data, especially for object oriented programs. Use folding function calls at run-time.

C++ Name Demangling

By default Intel® Trace Collector records function names in their mangled form. The DEMANGLE configuration option enables automatic demangling of C++ names.

See Also

Tracing Library Calls

For more complete information about compiler optimizations, see our Optimization Notice.