You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2. Run the native SNI tracing example to connect to SQL Server.
115
115
116
116
3. Stop tracing using the following command line.
117
117
118
-
```
118
+
```powershell
119
119
xperf -stop trace
120
120
```
121
121
122
-
4. Use PerfView to open the myTrace.etl file specified in Step 1. The SNI tracing log can be found with `Microsoft.Data.SqlClient.EventSource/SNIScope` and `Microsoft.Data.SqlClient.EventSource/SNITrace` event names.
122
+
4. Use [PerfView](https://github.com/microsoft/perfview) to open the myTrace.etl file specified in Step 1. The SNI tracing log can be found with `Microsoft.Data.SqlClient.EventSource/SNIScope` and `Microsoft.Data.SqlClient.EventSource/SNITrace` event names.
123
123
124
124

125
125
126
-
###Use PerfView to collect trace log
126
+
## Use PerfView to collect traces
127
127
128
-
1. Start PerfView and run `Collect > Collect` from the menu bar.
128
+
1. Start [PerfView](https://github.com/microsoft/perfview) and run `Collect > Collect` from the menu bar.
129
129
130
130
2. Configure the trace file name, output path, and provider name.
131
131
132
-

132
+

133
133
134
134
3. Start collection.
135
135
@@ -139,6 +139,42 @@ class Program
139
139
140
140
6. Open the `etl` file in PerfView. The SNI tracing log can be found with `Microsoft.Data.SqlClient.EventSource/SNIScope` and `Microsoft.Data.SqlClient.EventSource/SNITrace` event names.
141
141
142
+
## Use PerfCollect to collect traces
143
+
144
+
On Linux, PerfCollect can be used to capture traces. PerfCollect is a bash script that uses .NET tools to collect traces for .NET applications. For more information about PerfCollect, see [Performance Tracing on Linux](https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/linux-performance-tracing.md) The traces created by PerfCollect can be viewed in [PerfView](https://github.com/microsoft/perfview).
145
+
146
+
1. If not already installed, install curl (Ubuntu commands are provided):
147
+
148
+
```bash
149
+
sudo apt-get update
150
+
sudo apt-get install curl
151
+
```
152
+
153
+
1. Install PerfCollect:
154
+
155
+
```bash
156
+
sudo curl –OL http://aka.ms/perfcollect
157
+
sudo chmod +x perfcollect
158
+
sudo ./perfcollect install
159
+
```
160
+
161
+
1. Define environment variables for PerfCollect:
162
+
163
+
```bash
164
+
export COMPles_perfMapEnab;ed=1
165
+
export COMPlus_EnableEventLog=1
166
+
```
167
+
168
+
1. Collect logs:
169
+
170
+
```bash
171
+
sudo ./perfcollect collect <trace file name>
172
+
```
173
+
174
+
Run the application separately and let it run as long as needed to reproduce the issue. If it's a high CPU issue, 5-10 seconds is usually enough. Press CTRL+C to stop tracing.
175
+
176
+
Copy the trace file to another system and view it in [PerfView](https://github.com/microsoft/perfview).
177
+
142
178
## External resources
143
179
144
180
For another set of examples on how to trace Microsoft.Data.SqlClient cross-platform, see the [CSS SQL Networking Tools wiki](https://github.com/microsoft/CSS_SQL_Networking_Tools/wiki/Collect-a-.NET-Core-SQL-Driver-Trace).
0 commit comments