Table of Contents
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.
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
| Section | Description | Macro |
|---|---|---|
| memory | Memory management and block copying | VSIP_PROFILE_MEMORY |
| dispatch | Operation dispatch (incl. expression evaluation) | VSIP_PROFILE_DISPATCH |
| parallel | Parallel data I/O | VSIP_PROFILE_PARALLEL |
| func | Elementwise Functions | VSIP_PROFILE_FUNC |
| signal | Signal Processing | VSIP_PROFILE_SIGNAL |
| matvec | Matrix - Vector operations | VSIP_PROFILE_MATVEC |
| solver | Linear Algebra solvers | VISP_PROFILE_SOLVER |
| user | User-defined Operations | VSIP_PROFILE_USER |
| all | Everything | VSIP_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.
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.