Skip to content

document DOTNET_EventPipeThreadSamplingRate#53393

Open
pavelsavara wants to merge 4 commits intodotnet:mainfrom
pavelsavara:sampling_freq
Open

document DOTNET_EventPipeThreadSamplingRate#53393
pavelsavara wants to merge 4 commits intodotnet:mainfrom
pavelsavara:sampling_freq

Conversation

@pavelsavara
Copy link
Copy Markdown
Member

@pavelsavara pavelsavara commented Apr 27, 2026

@pavelsavara pavelsavara self-assigned this Apr 27, 2026
@dotnetrepoman dotnetrepoman Bot added this to the April 2026 milestone Apr 27, 2026
| **runtimeconfig.json** | N/A | N/A |
| **Environment variable** | `DOTNET_PerfMapEnabled` | `0` - disabled<br/>`1` - perf maps and jit dumps both enabled<br/>`2` - jit dumps enabled<br/>`3` - perf maps enabled |

## EventPipe thread sampling rate
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure it belongs here. All other event pipe env variables are in eventpipe.md

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree it feels odd to have just one EventPipe env var documented on this page when there are many. Perhaps a link to the eventpipe.md env var info would be a nice way to make the info discoverable without needing to replicate all of it here.

Comment thread docs/core/diagnostics/eventpipe.md Outdated
Comment thread docs/core/diagnostics/eventpipe.md Outdated
| **runtimeconfig.json** | N/A | N/A |
| **Environment variable** | `DOTNET_PerfMapEnabled` | `0` - disabled<br/>`1` - perf maps and jit dumps both enabled<br/>`2` - jit dumps enabled<br/>`3` - perf maps enabled |

## EventPipe thread sampling rate
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree it feels odd to have just one EventPipe env var documented on this page when there are many. Perhaps a link to the eventpipe.md env var info would be a nice way to make the info discoverable without needing to replicate all of it here.

Comment thread docs/core/runtime-config/debugging-profiling.md Outdated
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
@pavelsavara pavelsavara marked this pull request as ready for review April 29, 2026 06:06
Copilot AI review requested due to automatic review settings April 29, 2026 06:06
@pavelsavara pavelsavara requested review from a team, gewarren and tommcdon as code owners April 29, 2026 06:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR documents the DOTNET_EventPipeThreadSamplingRate environment variable and links readers to the EventPipe environment-variable tracing documentation so they can tune thread sampling frequency when collecting traces.

Changes:

  • Add DOTNET_EventPipeThreadSamplingRate to the EventPipe environment variables list, including defaults and behavior.
  • Add a tip to dotnet-trace profiles describing how to adjust the sampling rate via DOTNET_EventPipeThreadSamplingRate.
  • Add a cross-link from runtime debugging/profiling config docs to the EventPipe environment-variable tracing section.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
docs/core/runtime-config/debugging-profiling.md Adds a pointer to EventPipe environment-variable tracing docs.
docs/core/diagnostics/eventpipe.md Documents DOTNET_EventPipeThreadSamplingRate behavior and defaults.
docs/core/diagnostics/dotnet-trace.md Mentions how the dotnet-sampled-thread-time profile’s sampling rate can be configured.

Comment on lines 235 to 239
| `dotnet-sampled-thread-time` | Samples .NET thread stacks (~100 Hz) to identify hotspots over time. Uses the runtime sample profiler with managed stacks. |

> [!TIP]
> The sampling rate used by `dotnet-sampled-thread-time` can be changed with the `DOTNET_EventPipeThreadSamplingRate` environment variable (value in milliseconds). This setting is process-global and affects all EventPipe sessions. See [Trace using environment variables](./eventpipe.md#trace-using-environment-variables) for details.
| `gc-verbose` | Tracks GC collections and samples object allocations. |
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TIP block is inserted in the middle of the Markdown table for available profiles, which terminates the table after the dotnet-sampled-thread-time row and causes the gc-verbose, gc-collect, and database rows to render outside the table. Move the TIP either inside the dotnet-sampled-thread-time cell (as inline text) or place it after the table ends so the table remains contiguous.

Copilot uses AI. Check for mistakes.

* `DOTNET_EventPipeProcNumbers`: Set this to `1` to enable capturing processor numbers in EventPipe event headers. The default value is `0`.

* `DOTNET_EventPipeThreadSamplingRate`: Available in .NET 11+. Sets the interval, in milliseconds, for the EventPipe thread time sampling profiler. When set to `0` or omitted, the runtime uses its built-in default of 10 ms (~100 Hz). This setting is process-global and affects all EventPipe sessions, including on-demand traces started by tools such as [dotnet-trace](./dotnet-trace.md). Setting a large value reduces sampling overhead but also reduces the resolution of any trace collected during the process lifetime.
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider rephrasing "Available in .NET 11+" to a more standard version note (for example, "Available starting in .NET 11" or "Available in .NET 11 and later") to avoid the informal "+" shorthand in docs text.

Suggested change
* `DOTNET_EventPipeThreadSamplingRate`: Available in .NET 11+. Sets the interval, in milliseconds, for the EventPipe thread time sampling profiler. When set to `0` or omitted, the runtime uses its built-in default of 10 ms (~100 Hz). This setting is process-global and affects all EventPipe sessions, including on-demand traces started by tools such as [dotnet-trace](./dotnet-trace.md). Setting a large value reduces sampling overhead but also reduces the resolution of any trace collected during the process lifetime.
* `DOTNET_EventPipeThreadSamplingRate`: Available in .NET 11 and later. Sets the interval, in milliseconds, for the EventPipe thread time sampling profiler. When set to `0` or omitted, the runtime uses its built-in default of 10 ms (~100 Hz). This setting is process-global and affects all EventPipe sessions, including on-demand traces started by tools such as [dotnet-trace](./dotnet-trace.md). Setting a large value reduces sampling overhead but also reduces the resolution of any trace collected during the process lifetime.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants