document DOTNET_EventPipeThreadSamplingRate#53393
document DOTNET_EventPipeThreadSamplingRate#53393pavelsavara wants to merge 4 commits intodotnet:mainfrom
Conversation
| | **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 |
There was a problem hiding this comment.
I am not sure it belongs here. All other event pipe env variables are in eventpipe.md
There was a problem hiding this comment.
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.
| | **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 |
There was a problem hiding this comment.
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.
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
There was a problem hiding this comment.
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_EventPipeThreadSamplingRateto the EventPipe environment variables list, including defaults and behavior. - Add a tip to
dotnet-traceprofiles describing how to adjust the sampling rate viaDOTNET_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. |
| | `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. | |
There was a problem hiding this comment.
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.
|
|
||
| * `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. |
There was a problem hiding this comment.
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.
| * `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. |
Related to dotnet/runtime#127292
Internal previews