Skip to content

Commit bb0520d

Browse files
barosiaknoahfalkCopilotgewarren
authored
Update doc on profiling config settings (#49964)
Move profiler documentation from the runtime repo to the docs repo. Add description of new possible environment variable names. Fixes #49963 --------- Co-authored-by: Noah Falk <noahfalk@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
1 parent 10d47ea commit bb0520d

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

docs/core/runtime-config/debugging-profiling.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ This article details the settings you can use to configure .NET debugging and pr
99

1010
[!INCLUDE [complus-prefix](../../../includes/complus-prefix.md)]
1111

12+
> [!NOTE]
13+
> Starting in .NET 11, profiler environment variables now support both `DOTNET` and `CORECLR` prefixes. The `DOTNET` prefix is the new standard, while `CORECLR` is maintained for backwards compatibility and might be removed in the future.
14+
1215
## Enable diagnostics
1316

1417
- Configures whether the debugger, the profiler, and EventPipe diagnostics are enabled or disabled.
@@ -23,11 +26,12 @@ This article details the settings you can use to configure .NET debugging and pr
2326

2427
- Configures whether profiling is enabled for the currently running process.
2528
- If you omit this setting, profiling is disabled. This is equivalent to setting the value to `0`.
29+
- To load a profiler, in addition to enabling profiling, the profiler GUID and profiler location also need to be configured using these settings.
2630

2731
| | Setting name | Values |
2832
| - | - | - |
2933
| **runtimeconfig.json** | N/A | N/A |
30-
| **Environment variable** | `CORECLR_ENABLE_PROFILING` | `0` - disabled<br/>`1` - enabled |
34+
| **Environment variable** | `CORECLR_ENABLE_PROFILING` or `DOTNET_ENABLE_PROFILING` | `0` - disabled<br/>`1` - enabled |
3135

3236
## Profiler GUID
3337

@@ -36,19 +40,28 @@ This article details the settings you can use to configure .NET debugging and pr
3640
| | Setting name | Values |
3741
| - | - | - |
3842
| **runtimeconfig.json** | N/A | N/A |
39-
| **Environment variable** | `CORECLR_PROFILER` | *string-guid* |
43+
| **Environment variable** | `CORECLR_PROFILER` or `DOTNET_PROFILER` | *string-guid* |
4044

4145
## Profiler location
4246

47+
Once profiling is enabled, the profiler can be loaded in two ways: with environment variables (cross-plat) or through the registry (Windows only). The profiler path environment variables take precedence over any COM library path in the registry if both are specified.
48+
49+
### Environment variable (cross-plat)
50+
4351
- Specifies the path to the profiler DLL to load into the currently running process (or 32-bit or 64-bit process).
4452
- If more than one variable is set, the bitness-specific variables take precedence. They specify which bitness of profiler to load.
45-
- For more information, see [Finding the profiler library](https://github.com/dotnet/runtime/blob/main/docs/design/coreclr/profiling/Profiler%20Loading.md).
4653

4754
| | Setting name | Values |
4855
| - | - | - |
49-
| **Environment variable** | `CORECLR_PROFILER_PATH` | *string-path* |
50-
| **Environment variable** | `CORECLR_PROFILER_PATH_32` | *string-path* |
51-
| **Environment variable** | `CORECLR_PROFILER_PATH_64` | *string-path* |
56+
| **Environment variable** | `CORECLR_PROFILER_PATH` or `DOTNET_PROFILER_PATH` | *string-path* |
57+
| **Environment variable** | `CORECLR_PROFILER_PATH_32` or `DOTNET_PROFILER_PATH_32` | *string-path* |
58+
| **Environment variable** | `CORECLR_PROFILER_PATH_64` or `DOTNET_PROFILER_PATH_64` | *string-path* |
59+
| **Environment variable** | `CORECLR_PROFILER_PATH_ARM32` or `DOTNET_PROFILER_PATH_ARM32` | *string-path* |
60+
| **Environment variable** | `CORECLR_PROFILER_PATH_ARM64` or `DOTNET_PROFILER_PATH_ARM64` | *string-path* |
61+
62+
### Through the registry (Windows only)
63+
64+
When the `DOTNET_PROFILER_PATH*` [environment variables](#environment-variable-cross-plat) aren't set while running on Windows, coreclr looks up the CLSID from `DOTNET_PROFILER` in the registry to find the full path to the profiler's DLL. Just like with any COM server DLL, the profiler's CLSID is looked up under HKEY_CLASSES_ROOT, which merges the classes from HKLM and HKCU.
5265

5366
## Export perf maps and jit dumps
5467

0 commit comments

Comments
 (0)