Skip to content

Fix up dotnetcli labeling #30734

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions docs/core/diagnostics/dotnet-counters.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ There are two ways to download and install `dotnet-counters`:

## Synopsis

```console
```dotnetcli
dotnet-counters [-h|--help] [--version] <command>
```

Expand Down Expand Up @@ -68,7 +68,7 @@ Periodically collect selected counter values and export them into a specified fi

### Synopsis

```console
```dotnetcli
dotnet-counters collect [-h|--help] [-p|--process-id] [-n|--name] [--diagnostic-port] [--refresh-interval] [--counters <COUNTERS>] [--format] [-o|--output] [-- <command>]
```

Expand Down Expand Up @@ -122,7 +122,7 @@ dotnet-counters collect [-h|--help] [-p|--process-id] [-n|--name] [--diagnostic-

- Collect all counters at a refresh interval of 3 seconds and generate a csv as output:

```console
```dotnetcli
> dotnet-counters collect --process-id 1902 --refresh-interval 3 --format csv

counter_list is unspecified. Monitoring all counters by default.
Expand All @@ -131,7 +131,7 @@ dotnet-counters collect [-h|--help] [-p|--process-id] [-n|--name] [--diagnostic-

- Start `dotnet mvc.dll` as a child process and start collecting runtime counters and ASP.NET Core Hosting counters from startup and save it as a JSON output:

```console
```dotnetcli
> dotnet-counters collect --format json --counters System.Runtime,Microsoft.AspNetCore.Hosting -- dotnet mvc.dll
Starting a counter session. Press Q to quit.
File saved to counter.json
Expand All @@ -143,13 +143,13 @@ Displays a list of counter names and descriptions, grouped by provider.

### Synopsis

```console
```dotnetcli
dotnet-counters list [-h|--help]
```

### Example

```console
```dotnetcli
> dotnet-counters list
Showing well-known counters only. Specific processes may support additional counters.

Expand Down Expand Up @@ -190,7 +190,7 @@ Displays periodically refreshing values of selected counters.

### Synopsis

```console
```dotnetcli
dotnet-counters monitor [-h|--help] [-p|--process-id] [-n|--name] [--diagnostic-port] [--refresh-interval] [--counters] [-- <command>]
```

Expand Down Expand Up @@ -239,7 +239,7 @@ dotnet-counters monitor [-h|--help] [-p|--process-id] [-n|--name] [--diagnostic-

- Monitor all counters from `System.Runtime` at a refresh interval of 3 seconds:

```console
```dotnetcli
> dotnet-counters monitor --process-id 1902 --refresh-interval 3 --counters System.Runtime
Press p to pause, r to resume, q to quit.
Status: Running
Expand Down Expand Up @@ -272,7 +272,7 @@ dotnet-counters monitor [-h|--help] [-p|--process-id] [-n|--name] [--diagnostic-

- Monitor just CPU usage and GC heap size from `System.Runtime`:

```console
```dotnetcli
> dotnet-counters monitor --process-id 1902 --counters System.Runtime[cpu-usage,gc-heap-size]

Press p to pause, r to resume, q to quit.
Expand All @@ -285,7 +285,7 @@ dotnet-counters monitor [-h|--help] [-p|--process-id] [-n|--name] [--diagnostic-

- Monitor `EventCounter` values from user-defined `EventSource`. For more information, see [Tutorial: Measure performance using EventCounters in .NET Core](event-counter-perf.md).

```console
```dotnetcli
> dotnet-counters monitor --process-id 1902 --counters Samples-EventCounterDemos-Minimal

Press p to pause, r to resume, q to quit.
Expand All @@ -294,7 +294,7 @@ dotnet-counters monitor [-h|--help] [-p|--process-id] [-n|--name] [--diagnostic-

- View all well-known counters that are available in `dotnet-counters`:

```console
```dotnetcli
> dotnet-counters list

Showing well-known counters for .NET (Core) version 3.1 only. Specific processes may support additional counters.
Expand Down Expand Up @@ -328,7 +328,7 @@ dotnet-counters monitor [-h|--help] [-p|--process-id] [-n|--name] [--diagnostic-

- View all well-known counters that are available in `dotnet-counters` for .NET 5 apps:

```console
```dotnetcli
> dotnet-counters list --runtime-version 5.0

Showing well-known counters for .NET (Core) version 5.0 only. Specific processes may support additional counters.
Expand Down Expand Up @@ -387,7 +387,7 @@ dotnet-counters monitor [-h|--help] [-p|--process-id] [-n|--name] [--diagnostic-
> [!IMPORTANT]
> This works for apps running .NET 5 or later only.

```console
```dotnetcli
> dotnet-counters monitor --counters System.Runtime[assembly-count] -- my-aspnet-server.exe

Press p to pause, r to resume, q to quit.
Expand All @@ -402,11 +402,11 @@ dotnet-counters monitor [-h|--help] [-p|--process-id] [-n|--name] [--diagnostic-
> [!IMPORTANT]
> This works for apps running .NET 5 or later only.

```console
```dotnetcli
> dotnet-counters monitor --counters System.Runtime[working-set,gc-heap-size] -- my-aspnet-server.exe arg1 arg2
```

```console
```output
Press p to pause, r to resume, q to quit.
Status: Running

Expand All @@ -422,15 +422,15 @@ dotnet-counters monitor [-h|--help] [-p|--process-id] [-n|--name] [--diagnostic-

### Synopsis

```console
```dotnetcli
dotnet-counters ps [-h|--help]
```

### Example

Suppose you start a long-running app using the command ```dotnet run --configuration Release```. In another window, you run the ```dotnet-counters ps``` command. The output you'll see is as follows. The command-line arguments, if any, are shown in `dotnet-counters` version 6.0.320703 and later.

```console
```dotnetcli
> dotnet-counters ps

21932 dotnet C:\Program Files\dotnet\dotnet.exe run --configuration Release
Expand All @@ -450,27 +450,27 @@ However, when you want to gain a finer control over the lifetime of the app bein

1. The command below makes dotnet-counters create a diagnostics socket named `myport.sock` and wait for a connection.

> ```dotnet-cli
> ```dotnetcli
> dotnet-counters collect --diagnostic-port myport.sock
> ```

Output:

> ```bash
> ```output
> Waiting for connection on myport.sock
> Start an application with the following environment variable: DOTNET_DiagnosticPorts=/home/user/myport.sock
> ```

2. In a separate console, launch the target application with the environment variable `DOTNET_DiagnosticPorts` set to the value in the `dotnet-counters` output.

> ```bash
> ```console
> export DOTNET_DiagnosticPorts=/home/user/myport.sock
> ./my-dotnet-app arg1 arg2
> ```

This should then enable `dotnet-counters` to start collecting counters on `my-dotnet-app`:

> ```bash
> ```output
> Waiting for connection on myport.sock
> Start an application with the following environment variable: DOTNET_DiagnosticPorts=myport.sock
> Starting a counter session. Press Q to quit.
Expand Down
40 changes: 20 additions & 20 deletions docs/core/diagnostics/dotnet-trace.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ There are two ways to download and install `dotnet-trace`:

## Synopsis

```console
```dotnetcli
dotnet-trace [-h, --help] [--version] <command>
```

Expand Down Expand Up @@ -74,7 +74,7 @@ Collects a diagnostic trace from a running process or launches a child process a

### Synopsis

```console
```dotnetcli
dotnet-trace collect [--buffersize <size>] [--clreventlevel <clreventlevel>] [--clrevents <clrevents>]
[--format <Chromium|NetTrace|Speedscope>] [-h|--help]
[-n, --name <name>] [--diagnostic-port] [-o|--output <trace-file-path>] [-p|--process-id <pid>]
Expand Down Expand Up @@ -211,7 +211,7 @@ Converts `nettrace` traces to alternate formats for use with alternate trace ana

### Synopsis

```console
```dotnetcli
dotnet-trace convert [<input-filename>] [--format <Chromium|NetTrace|Speedscope>] [-h|--help] [-o|--output <output-filename>]
```

Expand Down Expand Up @@ -241,15 +241,15 @@ dotnet-trace convert [<input-filename>] [--format <Chromium|NetTrace|Speedscope>

### Synopsis

```console
```dotnetcli
dotnet-trace ps [-h|--help]
```

### Example

Suppose you start a long-running app using the command ```dotnet run --configuration Release```. In another window, you run the ```dotnet-trace ps``` command. The output you'll see is as follows. The command-line arguments, if available, are shown in `dotnet-trace` version 6.0.320703 and later.

```console
```dotnetcli
> dotnet-trace ps

21932 dotnet C:\Program Files\dotnet\dotnet.exe run --configuration Release
Expand All @@ -262,7 +262,7 @@ Lists pre-built tracing profiles with a description of what providers and filter

### Synopsis

```console
```dotnetcli
dotnet-trace list-profiles [-h|--help]
```

Expand All @@ -272,7 +272,7 @@ Creates a report into stdout from a previously generated trace.

### Synopsis

```console
```dotnetcli
dotnet-trace report [-h|--help] <tracefile> [command]
```

Expand All @@ -290,7 +290,7 @@ Finds the top N methods that have been on the callstack the longest.

##### Synopsis

```console
```dotnetcli
dotnet-trace report <tracefile> topN [-n|--number <n>] [--inclusive] [-v|--verbose] [-h|--help]
```

Expand Down Expand Up @@ -320,13 +320,13 @@ To collect traces using `dotnet-trace`:

- Run the following command:

```console
```dotnetcli
dotnet-trace collect --process-id <PID>
```

The preceding command generates output similar to the following:

```console
```output
Press <Enter> to exit...
Connecting to process: <Full-Path-To-Process-Being-Profiled>/dotnet.exe
Collecting to file: <Full-Path-To-Trace>/trace.nettrace
Expand All @@ -345,13 +345,13 @@ Sometimes it may be useful to collect a trace of a process from its startup. For

This will launch `hello.exe` with `arg1` and `arg2` as its command-line arguments and collect a trace from its runtime startup:

```console
```dotnetcli
dotnet-trace collect -- hello.exe arg1 arg2
```

The preceding command generates output similar to the following:

```console
```output
No profile or providers specified, defaulting to trace profile 'cpu-sampling'

Provider Name Keywords Level Enabled By
Expand Down Expand Up @@ -386,27 +386,27 @@ However, when you want to gain a finer control over the lifetime of the app bein

1. The command below makes `dotnet-trace` create a diagnostics socket named `myport.sock` and wait for a connection.

> ```dotnet-cli
> ```dotnetcli
> dotnet-trace collect --diagnostic-port myport.sock
> ```

Output:

> ```bash
> ```output
> Waiting for connection on myport.sock
> Start an application with the following environment variable: DOTNET_DiagnosticPorts=/home/user/myport.sock
> ```

2. In a separate console, launch the target application with the environment variable `DOTNET_DiagnosticPorts` set to the value in the `dotnet-trace` output.

> ```bash
> ```console
> export DOTNET_DiagnosticPorts=/home/user/myport.sock
> ./my-dotnet-app arg1 arg2
> ```

This should then enable `dotnet-trace` to start tracing `my-dotnet-app`:

> ```bash
> ```output
> Waiting for connection on myport.sock
> Start an application with the following environment variable: DOTNET_DiagnosticPorts=myport.sock
> Starting a counter session. Press Q to quit.
Expand Down Expand Up @@ -435,15 +435,15 @@ For traces collected on non-Windows platforms, you can also move the trace file

For example, to collect runtime performance counter values, use the following command:

```console
```dotnetcli
dotnet-trace collect --process-id <PID> --providers System.Runtime:0:1:EventCounterIntervalSec=1
```

The preceding command tells the runtime counters to report once every second for lightweight health monitoring. Replacing `EventCounterIntervalSec=1` with a higher value (for example, 60) allows collection of a smaller trace with less granularity in the counter data.

The following command reduces overhead and trace size more than the preceding one:

```console
```dotnetcli
dotnet-trace collect --process-id <PID> --providers System.Runtime:0:1:EventCounterIntervalSec=1,Microsoft-Windows-DotNETRuntime:0:1,Microsoft-DotNETCore-SampleProfiler:0:1
```

Expand All @@ -455,7 +455,7 @@ You can launch `dotnet-trace` with an `.rsp` file that contains the arguments to

For example, the following provider can be cumbersome to type out each time you want to trace:

```cmd
```dotnetcli
dotnet-trace collect --providers Microsoft-Diagnostics-DiagnosticSource:0x3:5:FilterAndPayloadSpecs="SqlClientDiagnosticListener/System.Data.SqlClient.WriteCommandBefore@Activity1Start:-Command;Command.CommandText;ConnectionId;Operation;Command.Connection.ServerVersion;Command.CommandTimeout;Command.CommandType;Command.Connection.ConnectionString;Command.Connection.Database;Command.Connection.DataSource;Command.Connection.PacketSize\r\nSqlClientDiagnosticListener/System.Data.SqlClient.WriteCommandAfter@Activity1Stop:\r\nMicrosoft.EntityFrameworkCore/Microsoft.EntityFrameworkCore.Database.Command.CommandExecuting@Activity2Start:-Command;Command.CommandText;ConnectionId;IsAsync;Command.Connection.ClientConnectionId;Command.Connection.ServerVersion;Command.CommandTimeout;Command.CommandType;Command.Connection.ConnectionString;Command.Connection.Database;Command.Connection.DataSource;Command.Connection.PacketSize\r\nMicrosoft.EntityFrameworkCore/Microsoft.EntityFrameworkCore.Database.Command.CommandExecuted@Activity2Stop:",OtherProvider,AnotherProvider
```

Expand All @@ -470,7 +470,7 @@ Microsoft-Diagnostics-DiagnosticSource:0x3:5:FilterAndPayloadSpecs="SqlClientDia

Once you've saved `myprofile.rsp`, you can launch `dotnet-trace` with this configuration using the following command:

```bash
```dotnetcli
dotnet-trace @myprofile.rsp
```

Expand Down