Used in profile-guided optimization to write all profile data from a running program to the PGC file.
pgosweep[options] image pgcfile
(Optional) The valid values for options are:
/helpdisplays the help message.
/resetresets counts to zero after sweep. This behavior is the default.
/pid:nonly sweeps the specified PID, where n is the PID number.
/waitwaits for the specified PID to terminate before collecting counts.
/onlyzerodoesn't save a PGC file, only zero counts.
/pausepauses count collection on the system.
/resumeresumes count collection on the system.
/noresetpreserves the count in the runtime data structures.
The PGC file where this command writes out the data counts.
pgosweep command works on programs that were built by using the
/FASTGENPROFILE option, or the deprecated
/LTCG:PGINSTRUMENT 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 gives you duplicate data if you retrieve the profile data later.
An alternative use for
pgosweep is to retrieve profile information just for the normal operation of the application. For example, you could run
pgosweep shortly after you start the application and discard that file. This command 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 the time the user could interact with the program.
When you name a PGC file (by using the pgcfile parameter) you can use the standard format, which is
appname!n.pgc. The n represents an increasing numeric value for each file. If you use this format, the compiler automatically finds this data in the
/LTCG /USEPROFILE or
/LTCG:PGO phase. If you don't use the standard format, you must use
pgomgr to merge the PGC files.
You can start this tool only from a Visual Studio developer command prompt. You can't start it from a system command prompt or from File Explorer.
For information on how to capture the profile data from within your executable, see
In this example command,
pgosweep writes the current profile information for
pgosweep myapp.exe myapp!1.pgc