|
1 | 1 | ---
|
2 | 2 | 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 |
4 | 5 | helpviewer_keywords: ["pgosweep program", "profile-guided optimizations, pgosweep"]
|
5 |
| -ms.assetid: f39dd3b7-1cd9-4c3b-8e8b-fb794744b757 |
6 | 6 | ---
|
7 | 7 | # pgosweep
|
8 | 8 |
|
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. |
10 | 10 |
|
11 | 11 | ## Syntax
|
12 | 12 |
|
13 |
| -> **pgosweep** [*options*] *image* *pgcfile* |
| 13 | +> **`pgosweep`** [*options*] *image* *pgcfile* |
14 | 14 |
|
15 | 15 | ### Parameters
|
16 | 16 |
|
17 |
| -*options*<br/> |
| 17 | +*options*\ |
18 | 18 | (Optional) The valid values for *options* are:
|
19 | 19 |
|
20 |
| -- **/?** or **/help** displays the help message. |
| 20 | +- **`/?`** or **`/help`** displays the help message. |
21 | 21 |
|
22 |
| -- **/noreset** preserves the count in the runtime data structures. |
| 22 | +- **`/reset`** resets counts to zero after sweep. This behavior is the default. |
23 | 23 |
|
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. |
26 | 25 |
|
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. |
29 | 41 |
|
30 | 42 | ## Remarks
|
31 | 43 |
|
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. |
33 | 45 |
|
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. |
35 | 47 |
|
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. |
37 | 49 |
|
38 | 50 | > [!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. |
40 | 52 |
|
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). |
42 | 54 |
|
43 | 55 | ## Example
|
44 | 56 |
|
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`*. |
46 | 58 |
|
47 | 59 | `pgosweep myapp.exe myapp!1.pgc`
|
48 | 60 |
|
49 | 61 | ## See also
|
50 | 62 |
|
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