/GENPROFILE, /FASTGENPROFILE (Generate Profiling Instrumented Build)

Specifies generation of a .pgd file by the linker to support profile-guided optimization (PGO). /GENPROFILE and /FASTGENPROFILE use different default parameters. Use /GENPROFILE to favor precision over speed and memory usage during profiling. Use /FASTGENPROFILE to favor smaller memory usage and speed over precision.

Syntax

/GENPROFILE[:{[COUNTER32|COUNTER64]|[EXACT|NOEXACT]|MEMMAX=#|MEMMIN=#|[PATH|NOPATH ]|[TRACKEH |NOTRACKEH ]|PGD=filename}]
/FASTGENPROFILE[:{[COUNTER32|COUNTER64]|[EXACT|NOEXACT]|MEMMAX=#|MEMMIN=#|[PATH|NOPATH ]|[TRACKEH |NOTRACKEH ]|PGD=filename}]

Arguments

Any of the following arguments may be specified to /GENPROFILE or /FASTGENPROFILE. Arguments listed here separated by a pipe (|) character are mutually exclusive. Use a comma (,) character to separate options.

COUNTER32 | COUNTER64
Use COUNTER32 to specify the use of 32-bit probe counters, and COUNTER64 to specify 64-bit probe counters. When you specify /GENPROFILE, the default is COUNTER64. When you specify /FASTGENPROFILE, the default is COUNTER32.

EXACT | NOEXACT
Use EXACT to specify thread-safe interlocked increments for probes. NOEXACT specifies unprotected increment operations for probes. The default is NOEXACT.

MEMMAX=value, MEMMIN=value
Use MEMMAX and MEMMIN to specify the maximum and minimum reservation sizes for training data in memory. The value is the amount of memory to reserve in bytes. By default, these values are determined by an internal heuristic.

PATH | NOPATH
Use PATH to specify a separate set of PGO counters for each unique path to a function. Use NOPATH to specify only one set of counters for each function. When you specify /GENPROFILE, the default is PATH . When you specify /FASTGENPROFILE, the default is NOPATH .

TRACKEH | NOTRACKEH
Specifies whether to use extra counters to keep an accurate count when exceptions are thrown during training. Use TRACKEH to specify extra counters for an exact count. Use NOTRACKEH to specify single counters for code that does not use exception handling or that does not encounter exceptions in your training scenarios. When you specify /GENPROFILE, the default is TRACKEH . When you specify /FASTGENPROFILE, the default is NOTRACKEH .

PGD=filename
Specifies a base file name for the .pgd file. By default, the linker uses the base executable image file name with a .pgd extension.

Remarks

The /GENPROFILE and /FASTGENPROFILE options tell the linker to generate the profiling instrumentation file needed to support application training for profile-guided optimization (PGO). These options are new in Visual Studio 2015. Prefer these options to the deprecated /LTCG:PGINSTRUMENT, /PGD and /POGOSAFEMODE options and the PogoSafeMode, VCPROFILE_ALLOC_SCALE and VCPROFILE_PATH environment variables. The profiling information generated by application training is used as input to perform targeted whole-program optimizations during builds. You can set additional options to control various profiling features for performance during app training and builds. The default options specified by /GENPROFILE give most accurate results, especially for large, complex multi-threaded apps. The /FASTGENPROFILE option uses different defaults for a lower memory footprint and faster performance during training, at the expense of accuracy.

Profiling information is captured when you run the instrumented app after you build by using /GENPROFILE of /FASTGENPROFILE. This information is captured when you specify the /USEPROFILE linker option to perform the profiling step and then used to guide the optimized build step. For more information on how to train your app and details on the collected data, see Profile Guided Optimization.

You must also specify /LTCG when you specify /GENPROFILE or /FASTGENPROFILE.

To set this linker option in the Visual Studio development environment

  1. Open the project's Property Pages dialog box. For details, see Setting Visual C++ Project Properties.

  2. Select the Configuration Properties > Linker > Command Line property page.

  3. Enter the /GENPROFILE or /FASTGENPROFILE options and arguments into the Additional Options box. Choose OK to save your changes.

To set this linker option programmatically

See also

Setting Linker Options
Linker Options
/LTCG (Link-time Code Generation)