Επεξεργασία

Κοινή χρήση μέσω


/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[:profile-argument[,profile-argument ...]]
/FASTGENPROFILE[:profile-argument[,profile-argument ...]]\

profile-argument
 { COUNTER32 | COUNTER64 }
 { EXACT | NOEXACT }
MEMMAX=value
MEMMIN=value
 { PATH | NOPATH }
 { TRACKEH | NOTRACKEH }
PGD=filename

Arguments

Any of the profile-argument 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 arguments. Don't put spaces between arguments, commas, or after the colon (:).

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 doesn't use exception handling or that doesn't run into 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 to the PogoSafeMode, VCPROFILE_ALLOC_SCALE, and VCPROFILE_PATH environment variables. The profiling information generated by application training is used as input for targeted whole-program optimizations during builds. You can also set other options to control various profiling features for performance during app training and builds. The default options specified by /GENPROFILE give the 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 do 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 optimizations.

Always 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 Set C++ compiler and build properties in Visual Studio.

  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

MSVC linker reference
MSVC linker options
/LTCG (Link-time code generation)