Skip to content

Commit 6e0718d

Browse files
Merge pull request #7016 from Mikejo5000/mikejo-br18
Updates for measuring app performance from the command line
2 parents 0d3d157 + a57dbd0 commit 6e0718d

File tree

2 files changed

+10
-88
lines changed

2 files changed

+10
-88
lines changed

docs/profiling/profile-apps-from-command-line.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ Profiling using the Visual Studio Diagnostics CLI tools works by attaching the p
3636

3737
1. Start Notepad, and then open Task Manager to get its process ID (PID). In Task Manager, find the PID in the **Details** tab.
3838

39-
1. Open a command prompt and change to the directory with the collection agent executable, typically here.
39+
1. Open a command prompt and change to the directory with the collection agent executable, typically here (for Visual Studio Enterprise).
4040

41-
```<Visual Studio installation folder>\2019\Preview\Team Tools\DiagnosticsHub\Collector\```
41+
```<Visual Studio installation folder>\2019\Enterprise\Team Tools\DiagnosticsHub\Collector\```
4242

4343
1. Start *VSDiagnostics.exe* by typing the following command.
4444

@@ -49,9 +49,15 @@ Profiling using the Visual Studio Diagnostics CLI tools works by attaching the p
4949
The arguments that must be included are:
5050

5151
* \<*id*> Identifies the collection session. The ID must be a number between 1-255.
52-
* \<*pid*>, PID of the process you wish to profile, in this case the PID you found in step 1
52+
* \<*pid*>, PID of the process you wish to profile, in this case the PID you found in step 1.
5353
* \<*configFile*>, configuration file for the collection agent you wish to launch. For more information, see [Configuration files for agents](#config_file).
5454

55+
For example, you could use the following command for the CPUUsageBase agent by replacing the *pid* as described previously.
56+
57+
```cmd
58+
VSDiagnostics.exe start 1 /attach:<pid> /loadConfig:AgentConfigs\CPUUsageLow.json
59+
```
60+
5561
1. Resize Notepad, or type something in it in order to make sure that some interesting profiling information is collected.
5662

5763
1. Stop the collection session and send output to a file by typing the following command.

docs/profiling/running-profiling-tools-with-or-without-the-debugger.md

Lines changed: 1 addition & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -83,88 +83,4 @@ You can save the reports, and open them from the **Recently Opened Sessions** li
8383

8484
## Collect profiling data from the command line
8585

86-
To measure performance data from the command line, you can use VSDiagnostics.exe, which is included with either Visual Studio or the Remote Tools. This is useful for capturing performance traces on systems where Visual Studio isn't installed, or for scripting the collection of performance traces. When you use VSDiagnostics.exe, you begin a diagnostic session that captures and stores profiling data until the tool is stopped. At that point, that data is exported into a .diagsession file, and you can open this file in Visual Studio to analyze results.
87-
88-
### Launch an application
89-
90-
1. Open a command prompt, and change to the directory with VSDiagnostics.exe:
91-
92-
```
93-
<Visual Studio Install Folder>\Team Tools\DiagnosticsHub\Collector\
94-
```
95-
96-
2. Start VSDiagnostics.exe with the following command:
97-
98-
```
99-
VSDiagnostics.exe start <id> /launch:<appToLaunch> /loadConfig:<configFile>
100-
```
101-
102-
You must include the following arguments:
103-
104-
- \<id\>: Identifies the collection session. The ID must be a number between 1-255.
105-
- \<appToLaunch\>: The executable file to launch and profile.
106-
- \<configFile\>: The configuration file for the collection agent you want to launch.
107-
108-
3. To stop collection and view your results, follow the steps in the "Stop collection" section later in this article.
109-
110-
### Attach to an existing application
111-
112-
1. Open an application, such as Notepad, and then open **Task Manager** to get its process ID (PID). In Task Manager, find the PID in the **Details** tab.
113-
2. Open a command prompt, and change to the directory with the collection agent executable. Typically, it's here:
114-
115-
```
116-
<Visual Studio installation folder>\2019\Preview\Team Tools\DiagnosticsHub\Collector\
117-
```
118-
119-
3. Start the VSDiagnostics.exe file by typing the following command.
120-
121-
```
122-
VSDiagnostics.exe start <id> /attach:<pid> /loadConfig:<configFile>
123-
```
124-
125-
You must include the following arguments:
126-
127-
- \<id\>: Identifies the collection session. The ID must be a number between 1-255.
128-
- \<pid\>: The PID of the process you want to profile, which in this case is the PID you found in step 1.
129-
- \<configFile\>: The configuration file for the collection agent you want to launch. For more information, see [Configuration files for agents](../profiling/profile-apps-from-command-line.md).
130-
131-
4. To stop collection and view your results, follow the steps in the next section.
132-
133-
### Stop collection
134-
135-
1. Stop the collection session, and send output to a file, by typing the following command.
136-
137-
```
138-
VSDiagnostics.exe stop <id> /output:<path to file>
139-
```
140-
141-
2. Go to the file output from the previous command, and open it in Visual Studio to examine the information collected.
142-
143-
## Agent configuration files
144-
145-
Collection agents are interchangeable components that collect different types of data, depending on what you are trying to measure.
146-
For convenience, you can store that information in an agent configuration file. The configuration file is a .json file that contains, at minimum, the name of the .dll file and its COM CLSID. Here are the example configuration files that you can find in the following folder:
147-
148-
```
149-
<Visual Studio installation folder>\Team Tools\DiagnosticsHub\Collector\AgentConfigs\
150-
```
151-
152-
Please see the following links to download and view agent configuration files:
153-
154-
- https://aka.ms/vs/diaghub/agentconfig/cpubase
155-
- https://aka.ms/vs/diaghub/agentconfig/cpuhigh
156-
- https://aka.ms/vs/diaghub/agentconfig/cpulow
157-
- https://aka.ms/vs/diaghub/agentconfig/database
158-
- https://aka.ms/vs/diaghub/agentconfig/dotnetasyncbase
159-
- https://aka.ms/vs/diaghub/agentconfig/dotnetallocbase
160-
- https://aka.ms/vs/diaghub/agentconfig/dotnetalloclow
161-
162-
CpuUsage configurations (Base/High/Low) correspond to data collected for the [CPU Usage](../profiling/cpu-usage.md) profiling tool.
163-
DotNetObjectAlloc configurations (Base/Low) correspond to data collected for the [.NET Object Allocation tool](../profiling/dotnet-alloc-tool.md).
164-
165-
Base/Low/High configurations refer to the sampling rate. For example, Low is 100 samples/second and High is 4000 samples/second.
166-
For the VSDiagnostics.exe tool to work with a collection agent, it requires both a DLL and a COM CLSID for the appropriate agent. The agent might also have additional configuration options. If you use an agent without a configuration file, use the format in the following command:
167-
168-
```
169-
VSDiagnostics.exe start <id> /attach:<pid> /loadAgent:<agentCLSID>;<agentName>[;<config>]
170-
```
86+
To measure performance data from the command line, you can use VSDiagnostics.exe, which is included with either Visual Studio or the Remote Tools. This is useful for capturing performance traces on systems where Visual Studio isn't installed, or for scripting the collection of performance traces. For detailed instructions, see [Measure application performance from the command line](../profiling/profile-apps-from-command-line.md).

0 commit comments

Comments
 (0)