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
* Update diagnostic-port details
- Include the diagnostic-port option for dotnet-gcdump which previously lacked it
- Give a bit more detail about how diagnostic-port should be specified for all the tools that currently support it
- Move the warnings about sharing the TMPDIR to the specific --name and --process-id arguments because it shouldn't be a requirement when specifying a full path using --diagnostic-port
* Apply suggestions from code review
Co-authored-by: Genevieve Warren <[email protected]>
The ID of the process to collect counter data from.
81
81
82
+
> [!NOTE]
83
+
> On Linux and macOS, using this option requires the target application and `dotnet-counters` to share the same `TMPDIR` environment variable. Otherwise, the command will time out.
84
+
82
85
-**`-n|--name <name>`**
83
86
84
87
The name of the process to collect counter data from.
85
88
86
-
-**`--diagnostic-port`**
89
+
> [!NOTE]
90
+
> On Linux and macOS, using this option requires the target application and `dotnet-counters` to share the same `TMPDIR` environment variable. Otherwise, the command will time out.
87
91
88
-
The name of the diagnostic port to create. See [using diagnostic port](#using-diagnostic-port) for how to use this option to start monitoring counters from app startup.
Sets the [diagnostic port](diagnostic-port.md) used to communicate with the process to be monitored. dotnet-counters and the .NET runtime inside the target process must agree on the port-address, with one listening and the other connecting. dotnet-counters automatically determines the correct port when attaching using the `--process-id` or `--name` options, or when launching a process using the `-- <command>` option. It's usually only necessary to specify the port explicitly when waiting for a process that will start in the future or communicating to a process that is running inside a container that isn't part of the current process namespace.
95
+
96
+
The `port-address` differs by OS:
97
+
98
+
- Linux and macOS - a path to a Unix domain socket such as `/foo/tool1.socket`.
99
+
- Windows - a path to a named pipe such as `\\.\pipe\my_diag_port1`.
100
+
- Android, iOS, and tvOS - an IP:port such as `127.0.0.1:9000`.
101
+
102
+
By default, dotnet-counters listens at the specified address. You can request dotnet-counters to connect instead by appending `,connect` after the address. For example, `--diagnostic-port /foo/tool1.socket,connect` will connect to a .NET runtime process that's listening to the `/foo/tool1.socket` Unix domain socket.
103
+
104
+
For information about how to use this option to start monitoring counters from app startup, see [using diagnostic port](#using-diagnostic-port).
> Launching a .NET executable via dotnet-counters will redirect its input/output and you won't be able to interact with its stdin/stdout. Exiting the tool via CTRL+C or SIGTERM will safely end both the tool and the child process. If the child process exits before the tool, the tool will exit as well. If you need to use stdin/stdout, you can use the `--diagnostic-port` option. See [Using diagnostic port](#using-diagnostic-port) for more information.
115
131
116
-
> [!NOTE]
117
-
> On Linux and macOS, this command expects the target application and `dotnet-counters` to share the same `TMPDIR` environment variable. Otherwise, the command will time out.
118
-
119
132
> [!NOTE]
120
133
> To collect metrics using `dotnet-counters`, it needs to be run as the same user as the user running target process or as root. Otherwise, the tool will fail to establish a connection with the target process.
> On Linux and macOS, using this option requires the target application and `dotnet-gcdump` to share the same `TMPDIR` environment variable. Otherwise, the command will time out.
98
+
96
99
-**`-o|--output <gcdump-file-path>`**
97
100
98
101
The path where collected GC dumps should be written. Defaults to *.\\YYYYMMDD\_HHMMSS\_\<pid>.gcdump*.
The name of the process to collect the GC dump from.
111
114
112
-
> [!NOTE]
113
-
> On Linux and macOS, this command expects the target application and `dotnet-gcdump` to share the same `TMPDIR` environment variable. Otherwise, the command will time out.
115
+
> [!NOTE]
116
+
> On Linux and macOS, using this option requires the target application and `dotnet-gcdump` to share the same `TMPDIR` environment variable. Otherwise, the command will time out.
Sets the [diagnostic port](diagnostic-port.md) used to communicate with the process to be dumped. dotnet-gcdump and the .NET runtime inside the target process must agree on the port-address, with one listening and the other connecting. dotnet-gcdump automatically determines the correct port when attaching using the `--process-id` or `--name` options. It's usually only necessary to specify the port explicitly when communicating to a process that's running inside a container that isn't part of the current process namespace.
121
+
122
+
The `port-address` differs by OS:
123
+
124
+
- Linux and macOS - a path to a Unix domain socket such as `/foo/tool1.socket`.
125
+
- Windows - a path to a named pipe such as `\\.\pipe\my_diag_port1`.
126
+
- Android, iOS, and tvOS - an IP:port such as `127.0.0.1:9000`.
127
+
128
+
By default, dotnet-gcdump listens at the specified address. You can request dotnet-gcdump to connect instead by appending `,connect` after the address. For example, `--diagnostic-port /foo/tool1.socket,connect` will connect to a .NET runtime process that's listening to the `/foo/tool1.socket` Unix domain socket.
114
129
115
130
> [!NOTE]
116
131
> To collect a GC dump using `dotnet-gcdump`, it needs to be run as the same user as the user running target process or as root. Otherwise, the tool will fail to establish a connection with the target process.
The name of the process to collect the trace from.
163
163
164
-
-**`--diagnostic-port <path-to-port>`**
164
+
> [!NOTE]
165
+
> On Linux and macOS, using this option requires the target application and `dotnet-trace` to share the same `TMPDIR` environment variable. Otherwise, the command will time out.
Sets the [diagnostic port](diagnostic-port.md) used to communicate with the process to be traced. dotnet-trace and the .NET runtime inside the target process must agree on the port-address, with one listening and the other connecting. dotnet-trace automatically determines the correct port when attaching using the `--process-id` or `--name` options, or when launching a process using the `-- <command>` option. It's usually only necessary to specify the port explicitly when waiting for a process that will start in the future or communicating to a process that is running inside a container that isn't part of the current process namespace.
165
170
166
-
The name of the diagnostic port to create. See [Use diagnostic port to collect a trace from app startup](#use-diagnostic-port-to-collect-a-trace-from-app-startup) to learn how to use this option to collect a trace from app startup.
171
+
The `port-address` differs by OS:
172
+
173
+
- Linux and macOS - a path to a Unix domain socket such as `/foo/tool1.socket`.
174
+
- Windows - a path to a named pipe such as `\\.\pipe\my_diag_port1`.
175
+
- Android, iOS, and tvOS - an IP:port such as `127.0.0.1:9000`.
176
+
177
+
By default, `dotnet-trace` listens at the specified address. You can request `dotnet-trace` to connect instead by appending `,connect` after the address. For example, `--diagnostic-port /foo/tool1.socket,connect` will connect to a .NET runtime process that is listening to the `/foo/tool1.socket` Unix domain socket.
178
+
179
+
To learn how to use this option to collect a trace from app startup, see [Use diagnostic port to collect a trace from app startup](#use-diagnostic-port-to-collect-a-trace-from-app-startup).
> On Linux and macOS, using this option requires the target application and `dotnet-trace` to share the same `TMPDIR` environment variable. Otherwise, the command will time out.
195
+
180
196
-**`--profile <profile-name>`**
181
197
182
198
A named pre-defined set of provider configurations that allows common tracing scenarios to be specified succinctly. The following profiles are available:
> - Stopping the trace may take a long time (up to minutes) for large applications. The runtime needs to send over the type cache for all managed code that was captured in the trace.
232
248
233
-
> - On Linux and macOS, this command expects the target application and `dotnet-trace` to share the same `TMPDIR` environment variable. Otherwise, the command will time out.
234
-
235
249
> - To collect a trace using `dotnet-trace`, it needs to be run as the same user as the user running the target process or as root. Otherwise, the tool will fail to establish a connection with the target process.
236
250
237
251
> - If you experience an unhandled exception while running `dotnet-trace collect`, this results in an incomplete trace. If finding the root cause of the exception is your priority, navigate to [Collect dumps on crash](collect-dumps-crash.md). As a result of the unhandled exception, the trace is truncated when the runtime shuts down to prevent other undesired behavior such as a hang or data corruption. Even though the trace is incomplete, you can still open it to see what happened leading up to the failure. However, it will be missing Rundown information (this happens at the end of a trace) so stacks might be unresolved (depending on what providers were turned on). Open the trace by executing PerfView with the `/ContinueOnError` flag at the command line. The logs will also contain the location the exception was fired.
0 commit comments