Redigeeri

Jagamisviis:


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 to use for the .pgc files added by 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 does 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.

Examples

In this example, the PGO Manager adds pgcFile.pgc to pgdFile.pgd six times:

pgomgr /merge:6 pgcFile.pgc pgdFile.pgd

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

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

If the PGO Manager is run without any .pgc file arguments, it searches the local directory for all .pgc files that have the same base name as the .pgd file followed by an exclamation mark (!) and then one or more arbitrary characters. For example, 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 pgomgr merges test!1.pgc and test!hello.pgc into test.pgd.

pgomgr /merge test.pgd

See also

Profile-Guided Optimizations