Skip to content

Commit 240ecce

Browse files
authored
Add a warning about perfcollect Lttng incompatibility (#45776)
1 parent 2d3fb58 commit 240ecce

File tree

1 file changed

+56
-59
lines changed

1 file changed

+56
-59
lines changed

docs/core/diagnostics/trace-perfcollect-lttng.md

+56-59
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Tracing .NET applications with PerfCollect.
33
description: A tutorial that walks you through collecting a trace with perfcollect in .NET.
44
ms.topic: tutorial
5-
ms.date: 10/23/2020
5+
ms.date: 04/10/2025
66
---
77

88
# Trace .NET applications with PerfCollect
@@ -22,27 +22,26 @@ Follow these steps to prepare your machine to collect a performance trace with `
2222
2323
1. Download `perfcollect`.
2424

25-
> ```bash
26-
> curl -OL https://aka.ms/perfcollect
27-
> ```
25+
```bash
26+
curl -OL https://aka.ms/perfcollect
27+
```
2828

29-
2. Make the script executable.
29+
1. Make the script executable.
3030

31-
> ```bash
32-
> chmod +x perfcollect
33-
> ```
31+
```bash
32+
chmod +x perfcollect
33+
```
3434

35-
3. Install tracing prerequisites - these are the actual tracing libraries.
35+
1. Install tracing prerequisites - these are the actual tracing libraries.
3636

37-
> ```bash
38-
> sudo ./perfcollect install
39-
> ```
37+
```bash
38+
sudo ./perfcollect install
39+
```
4040

4141
This will install the following prerequisites on your machine:
4242

4343
1. `perf`: the Linux Performance Events subsystem and companion user-mode collection/viewer application. `perf` is part of the Linux kernel source, but is not usually installed by default.
44-
45-
2. `LTTng`: Used to capture event data emitted at run time by CoreCLR. This data is then used to analyze the behavior of various runtime components such as the GC, JIT, and thread pool.
44+
1. `LTTng`: Used to capture event data emitted at run time by CoreCLR. This data is then used to analyze the behavior of various runtime components such as the GC, JIT, and thread pool.
4645

4746
Recent versions of .NET Core and the Linux perf tool support automatic resolution of method names for framework code.
4847

@@ -51,62 +50,63 @@ For resolving method names of native runtime DLLs (such as libcoreclr.so), `perf
5150
## Collect a trace
5251

5352
1. Have two shells available - one for controlling tracing, referred to as **[Trace]**, and one for running the application, referred to as **[App]**.
53+
1. **[Trace]** Start collection.
5454

55-
2. **[Trace]** Start collection.
56-
57-
> ```bash
58-
> sudo ./perfcollect collect sampleTrace
59-
> ```
55+
```bash
56+
sudo ./perfcollect collect sampleTrace
57+
```
6058

6159
Expected Output:
6260

63-
> ```bash
64-
> Collection started. Press CTRL+C to stop.
65-
> ```
61+
```bash
62+
Collection started. Press CTRL+C to stop.
63+
```
6664

67-
3. **[App]** Set up the application shell with the following environment variables - this enables tracing configuration of CoreCLR.
65+
> [!NOTE]
66+
> LTTng had a breaking change between versions 2.12 and 2.13. The .NET runtime currently supports version 2.12. If your Linux distribution has adopted 2.13 or later then we recommend disabling the LTTng portion of the perfcollect functionality. To do this add the option '-nolttng' to the perfcollect command-line and in step 3 do not set the DOTNET_EnableEventLog environment variable.
6867

69-
> ```bash
70-
> export DOTNET_PerfMapEnabled=1
71-
> export DOTNET_EnableEventLog=1
72-
> ```
68+
1. **[App]** Set up the application shell with the following environment variables - this enables tracing configuration of CoreCLR.
69+
1. **[App]** Set up the application shell with the following environment variables - this enables tracing configuration of CoreCLR.
70+
71+
```bash
72+
export DOTNET_PerfMapEnabled=1
73+
export DOTNET_EnableEventLog=1
74+
```
7375

7476
> [!NOTE]
7577
> When executing the app with .NET 7, you must also set `DOTNET_EnableWriteXorExecute=0` in addition to the preceding environment variables. For example:
7678
>
7779
> ```bash
7880
> export DOTNET_EnableWriteXorExecute=0
7981
> ```
82+
>
8083

81-
[!INCLUDE [complus-prefix](../../../includes/complus-prefix.md)]
82-
83-
4. **[App]** Run the app - let it run as long as you need to in order to capture the performance problem. The exact length can be as short as you need as long as it sufficiently captures the window of time where the performance problem you want to investigate occurs.
84+
[!INCLUDE [complus-prefix](../../../includes/complus-prefix.md)]
8485

85-
> ```bash
86-
> dotnet run
87-
> ```
86+
1. **[App]** Run the app - let it run as long as you need to in order to capture the performance problem. The exact length can be as short as you need as long as it sufficiently captures the window of time where the performance problem you want to investigate occurs.
8887

89-
5. **[Trace]** Stop collection - hit CTRL+C.
88+
```bash
89+
dotnet run
90+
```
9091

91-
> ```bash
92-
> ^C
93-
> ...STOPPED.
94-
>
95-
> Starting post-processing. This may take some time.
96-
>
97-
> Generating native image symbol files
98-
> ...SKIPPED
99-
> Saving native symbols
100-
> ...FINISHED
101-
> Exporting perf.data file
102-
> ...FINISHED
103-
> Compressing trace files
104-
> ...FINISHED
105-
> Cleaning up artifacts
106-
> ...FINISHED
107-
>
108-
> Trace saved to sampleTrace.trace.zip
109-
> ```
92+
1. **[Trace]** Stop collection - press <kbd>Ctrl</kbd>+<kbd>C</kbd>.
93+
94+
```output
95+
^C
96+
...STOPPED.
97+
Starting post-processing. This may take some time.
98+
Generating native image symbol files
99+
...SKIPPED
100+
Saving native symbols
101+
...FINISHED
102+
Exporting perf.data file
103+
...FINISHED
104+
Compressing trace files
105+
...FINISHED
106+
Cleaning up artifacts
107+
...FINISHED
108+
Trace saved to sampleTrace.trace.zip
109+
```
110110

111111
The compressed trace file is now stored in the current working directory.
112112

@@ -147,18 +147,15 @@ To see an aggregate view of both the CPU sample and the events, you can use `Per
147147

148148
3. Run PerfView.exe
149149

150-
> ```cmd
151-
> PerfView.exe <path to trace.zip file>
152-
> ```
150+
```cmd
151+
PerfView.exe <path to trace.zip file>
152+
```
153153

154154
PerfView will display the list of views that are supported based on the data contained in the trace file.
155155

156156
- For CPU investigations, choose **CPU stacks**.
157-
158157
- For detailed GC information, choose **GCStats**.
159-
160158
- For per-process/module/method JIT information, choose **JITStats**.
161-
162159
- If there is not a view for the information you need, you can try looking for the events in the raw events view. Choose **Events**.
163160

164161
For more information on how to interpret views in PerfView, see help links in the view itself, or from the main window in PerfView, choose **Help->Users Guide**.

0 commit comments

Comments
 (0)