Share via


How to: Merge Multiple PGO Profiles into a Single Profile

 

The latest version of this topic can be found at How to: Merge Multiple PGO Profiles into a Single Profile.

Profile-guided optimization (PGO) is a great tool for creating optimized binaries based on a scenario that is profiled. But what if you have an application that has several important, yet distinct scenarios; how do you create a single profile that PGO can use from several different scenarios? In Visual Studio, the PGO Manager, Pgomgr.exe, does this job for you.

The syntax for merging profiles is:

pgomgr /merge[:num] [.pgc_files] .pgd_files  

where num is an optional weight that is being used for this merge. Weights are commonly used if there are some scenarios that are more important than others or if there are scenarios that are to be run multiple times.

Note

The PGO Manager will not work with stale profile data. To merge a .pgc file into a .pgd file, the .pgc file must be generated by an executable which was created by the same link invocation that generated the .pgd file.

Example

In this example, the PGO Manager will add pgcFile.pgc to pgdFile.pgd six times.

pgomgr /merge:6 pgcFile.pgc pgdFile.pgd  

Example

In this example, the PGO Manager will add pgcFile1.pgc and pgcFile2.pgc to pgdFile.pgd, two times for each .pgc file.

pgomgr /merge:2 pgcFile1.pgc pgcFile2.pgc pgdFile.pgd  

Example

If the PGO Manager is run without a .pgc file it will search the local directory for all .pgc files that have the same name as the .pgd file appended with an exclamation mark (!) followed by arbitrary characters. If the local directory has files test.pgd, test!1.pgc, test2.pgc, and test!hello.pgc, and the following command is run from the local directory, then test!1.pgc and test!hello.pgc will be merged into test.pgd.

pgomgr /merge test.pgd  

See Also

Profile-Guided Optimizations