Skip to content

Commit f3ca731

Browse files
authored
Merge pull request #3229 from corob-msft/docs/corob/pgosweep-per-david-gillies
Add additional pgosweep options per David Gillies
2 parents 975090d + 7fa20b6 commit f3ca731

File tree

1 file changed

+31
-19
lines changed

1 file changed

+31
-19
lines changed

docs/build/pgosweep.md

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,64 @@
11
---
22
title: "pgosweep"
3-
ms.date: "03/14/2018"
3+
description: "Use the pgosweep command to write profile data to a PGC file for use in profile-guided optimization."
4+
ms.date: 10/23/2020
45
helpviewer_keywords: ["pgosweep program", "profile-guided optimizations, pgosweep"]
5-
ms.assetid: f39dd3b7-1cd9-4c3b-8e8b-fb794744b757
66
---
77
# pgosweep
88

9-
Used in profile-guided optimization to write all profile data from a running program to the .pgc file.
9+
Used in profile-guided optimization to write all profile data from a running program to the PGC file.
1010

1111
## Syntax
1212

13-
> **pgosweep** [*options*] *image* *pgcfile*
13+
> **`pgosweep`** [*options*] *image* *pgcfile*
1414
1515
### Parameters
1616

17-
*options*<br/>
17+
*options*\
1818
(Optional) The valid values for *options* are:
1919

20-
- **/?** or **/help** displays the help message.
20+
- **`/?`** or **`/help`** displays the help message.
2121

22-
- **/noreset** preserves the count in the runtime data structures.
22+
- **`/reset`** resets counts to zero after sweep. This behavior is the default.
2323

24-
*image*<br/>
25-
The full path of an .exe or .dll file that was created by using the [/GENPROFILE](reference/genprofile-fastgenprofile-generate-profiling-instrumented-build.md), [/FASTGENPROFILE](reference/genprofile-fastgenprofile-generate-profiling-instrumented-build.md), or [/LTCG:PGINSTRUMENT](reference/ltcg-link-time-code-generation.md) option.
24+
- **`/pid:n`** only sweeps the specified PID, where *n* is the PID number.
2625

27-
*pgcfile*<br/>
28-
The .pgc file where this command writes out the data counts.
26+
- **`/wait`** waits for the specified PID to terminate before collecting counts.
27+
28+
- **`/onlyzero`** doesn't save a PGC file, only zero counts.
29+
30+
- **`/pause`** pauses count collection on the system.
31+
32+
- **`/resume`** resumes count collection on the system.
33+
34+
- **`/noreset`** preserves the count in the runtime data structures.
35+
36+
*image*\
37+
The full path of an EXE or DLL file that was created by using the [`/GENPROFILE`](reference/genprofile-fastgenprofile-generate-profiling-instrumented-build.md), [`/FASTGENPROFILE`](reference/genprofile-fastgenprofile-generate-profiling-instrumented-build.md), or [`/LTCG:PGINSTRUMENT`](reference/ltcg-link-time-code-generation.md) option.
38+
39+
*pgcfile*\
40+
The PGC file where this command writes out the data counts.
2941

3042
## Remarks
3143

32-
The **pgosweep** command works on programs that were built by using the [/GENPROFILE or /FASTGENPROFILE](reference/genprofile-fastgenprofile-generate-profiling-instrumented-build.md) option, or the deprecated [/LTCG:PGINSTRUMENT](reference/ltcg-link-time-code-generation.md) 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.
44+
The **`pgosweep`** command works on programs that were built by using the [`/GENPROFILE` or `/FASTGENPROFILE`](reference/genprofile-fastgenprofile-generate-profiling-instrumented-build.md) option, or the deprecated [`/LTCG:PGINSTRUMENT`](reference/ltcg-link-time-code-generation.md) 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.
3345

34-
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 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.
46+
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.
3547

36-
When you name a .pgc file (by using the *pgcfile* parameter) you can use the standard format, which is *appname!n*.pgc. If you use this format, the compiler automatically finds this data in the **/LTCG /USEPROFILE** or **/LTCG:PGO** phase. If you do not use the standard format, you must use [pgomgr](pgomgr.md) to merge the .pgc files.
48+
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`](pgomgr.md) to merge the PGC files.
3749

3850
> [!NOTE]
39-
> You can start this tool only from a Visual Studio developer command prompt. You cannot start it from a system command prompt or from File Explorer.
51+
> 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.
4052
41-
For information on how to capture the profile data from within your executable, see [PgoAutoSweep](pgoautosweep.md).
53+
For information on how to capture the profile data from within your executable, see [`PgoAutoSweep`](pgoautosweep.md).
4254

4355
## Example
4456

45-
In this example command, **pgosweep** writes the current profile information for myapp.exe to myapp!1.pgc.
57+
In this example command, **`pgosweep`** writes the current profile information for *`myapp.exe`* to *`myapp!1.pgc`*.
4658

4759
`pgosweep myapp.exe myapp!1.pgc`
4860

4961
## See also
5062

51-
[Profile-Guided Optimizations](profile-guided-optimizations.md)<br/>
52-
[PgoAutoSweep](pgoautosweep.md)<br/>
63+
[Profile-Guided Optimizations](profile-guided-optimizations.md)\
64+
[PgoAutoSweep](pgoautosweep.md)

0 commit comments

Comments
 (0)