Intel® C++ Compiler 16.0 User and Reference Guide

API Support Overview

The Profile-Guided Optimizations (PGO) API lets you control the generation of profile information during the instrumented execution phase of profile-guided optimizations.

A set of functions and an environment variable comprise the PGO API. The remaining topics in this section describe the associated functions and environment variables.

The compiler sets a define for the _PGO_INSTRUMENT pre-processor macro when you compile with [Q]prof-gen options, to instrument your code. Without instrumentation, the PGO API functions cannot provide PGO API support.

Normally, profile information is generated by an instrumented application when it terminates by calling the standard exit() function.

To ensure that profile information is generated, the functions described in this section may be necessary or useful in the following situations:

You can use the PGO API functions in your application by including the pgouser.h header file at the top of any source file where the functions may be used.

Example

#include <pgouser.h>

Note

You do not need to remove the PGO API functions from your code when you have completed the instrumentation step. Changes to the source code at this stage could inhibit obtaining profile data feedback on the routines that were modified. For the instrumentation step (using -[Q]prof-gen or -[Q]prof-gen:<aug> option, where <aug> can be srcpos, globdata, or default), the definition for the _PGO_INSTRUMENT macro is automatically set, allowing instrumentation library routines to be used. For the production step (using -[Q]prof-use option), the definition for the _PGO_INSTRUMENT macro is removed, allowing profile data to be fed back.

The Profile IGS Environment Variables

The environment variable for PGO API is INTEL_PROF_DUMP_INTERVAL. This environment variable may be used to initiate Interval Profile Dumping in an instrumented user application.

The environment variable, INTEL_PROF_DYN_PREFIX, allows specifying a prefix string that is used for naming the .dyn files. If this variable is defined then the .dyn files will be named as <prefix>_<timestamp>_<pid>.dyn, instead of the default naming convention of <timestamp>_<pid>.dyn. This can be useful for identifying .dyn files produced by specific training sets.

See Also