Chapter 5. Profiling

Table of Contents

5.1. Enabling Profiling
5.2. Using the Profiler
5.3. Profiler Output

This reference explains how to compile a program with profiling statements enabled, how to use the profiling functions in order to investigate the execution timing of a program and finally how to interprete the resulting profile data.

5.1. Enabling Profiling

5.1.1. Configure and Compile Options

There are no configure options for profiling, instead it is enabled via compile-time options. However, to use profiling it is necessary to configure the library with a suitable high-resolution timer (refer to the Quickstart for details on this and other configuration options). For example,

--enable-timer=x86_64_tsc

Pre-built versions of the library enable a suitable timer for your system.

You may enable profiling per category by defining the corresponding macros for all the categories you want to enable. On many systems, these macros may be added to the CXXFLAGS variable in the project makefile, e.g.

CXXFLAGS="-DVSIP_PROFILE_USER -DVSIP_PROFILE_MEMORY"

.

Table 5.1. Profiling Configuration Mask

SectionDescriptionMacro
memoryMemory management and block copyingVSIP_PROFILE_MEMORY
dispatchOperation dispatch (incl. expression evaluation)VSIP_PROFILE_DISPATCH
parallelParallel data I/OVSIP_PROFILE_PARALLEL
funcElementwise FunctionsVSIP_PROFILE_FUNC
signalSignal ProcessingVSIP_PROFILE_SIGNAL
matvecMatrix - Vector operationsVSIP_PROFILE_MATVEC
solverLinear Algebra solversVISP_PROFILE_SOLVER
userUser-defined OperationsVSIP_PROFILE_USER
allEverythingVSIP_PROFILE_ALL

The above macros may be defined on the command line, or in a header, as long as that is included before any Sourcery VSIPL++ header.

5.1.2. Command Line Options

For programs that have been compiled with profiling enabled, the profiling mode and output file can be controlled from the command line. You may profile programs without modifying your source files using this method. Use this to choose the profiler mode:

--vsip-profile-mode=mode

where mode is either accum or trace.

Specify the path to the log file for profile output using:

--vsip-profile-output=/path/to/logfile

The second option defaults to the standard output on most systems, so it may be omitted if that is desireable.

The profiling command line options control profiling for the entire program execution. For finer grain control, such as enabling profiling during a specific portion of the program, or to mix different profiling modes, explicit profiling objects can be created.