Used in profile-guided optimization to write all profile data from a running program to the .pgc file.
This command works on programs that were built with the /LTCG:PGINSTRUMENT compiler option. It interrupts a running program and writes the profile data to a new .pgc file. By default, the command resets counts after each write operation. If you specify the /noreset option, the command will record the values, but not reset them in the running program. This option will give you duplicate data if you retrieve the profile data later.
An alternative use for pgosweep is to retrieve profile information just for the runtime of the application. For example, you could run pgosweep shortly after you start the application and discard that file. This would remove profile data associated with startup costs. Then, you can run pgosweep before ending the application. Now the collected data has profile information only from runtime.
When you name a .pgc file (pgcfile) you can use the standard format, which is appname!n.pgc. If you use this format, the compiler will find this data in the /LTCG:PGO phase. If you do not use the standard format, you must use pgomgr to merge the .pgc files.
pgosweep myapp.exe myapp!1.pgc
In this example, pgosweep writes the current profile information for myapp.exe to myapp!1.pgc.