Breyta

Deila með


/POGOSAFEMODE (Run PGO in thread safe mode)

The /POGOSAFEMODE option is deprecated starting in Visual Studio 2015. Use the /GENPROFILE:EXACT and /GENPROFILE:NOEXACT options instead. The /POGOSAFEMODE linker option specifies that the instrumented build is created to use thread-safe mode for profile data capture during profile-guided optimization (PGO) training runs.

Syntax

/POGOSAFEMODE

Remarks

Profile-guided optimization (PGO) has two possible modes during the profiling phase: fast mode and safe mode. When profiling is in fast mode, it uses an increment instruction to increase data counters. The increment instruction is faster but is not thread-safe. When profiling is in safe mode, it uses the interlocked-increment instruction to increase data counters. This instruction has the same functionality as the increment instruction has, and is thread-safe, but it is slower.

The /POGOSAFEMODE option sets the instrumented build to use safe mode. This option can only be used when the deprecated /LTCG:PGINSTRUMENT is specified, during the PGO instrumentation linker phase.

By default, PGO profiling operates in fast mode. /POGOSAFEMODE is only required if you want to use safe mode.

To run PGO profiling in safe mode, you must use either /GENPROFILE:EXACT (preferred), or use the environment variable PogoSafeMode or the linker switch /POGOSAFEMODE, depending on the system. If you are performing the profiling on an x64 computer, you must use the linker switch. If you are performing the profiling on an x86 computer, you may use the linker switch or define the environment variable to any value before you start the PGO instrumentation process.

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 > Optimization property page.

  3. In the Link Time Code Generation property, choose Profile Guided Optimization - Instrument (/LTCG:PGInstrument).

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

  5. Enter the /POGOSAFEMODE option into the Additional Options box. Choose OK to save your changes.

To set this linker option programmatically

See also

/GENPROFILE and /FASTGENPROFILE
/LTCG
Profile-Guided Optimizations
Environment Variables for Profile-Guided Optimizations