Skip to content

Commit b0aa5e4

Browse files
Document how to collect event traces
Collecting from the two EventSource providers differs by tooling, not by platform: dotnet-trace/EventPipe works the same everywhere, with ETW/PerfView as the Windows-only alternative. The doc lists the keyword masks and levels so sessions can enable only the areas of interest. Assisted-by: Claude:claude-fable-5:Claude Code
1 parent 7cc6ae4 commit b0aa5e4

1 file changed

Lines changed: 81 additions & 0 deletions

File tree

docs/CollectingEventTraces.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Collecting event traces
2+
3+
ILSpy emits performance trace events through two `EventSource` providers:
4+
5+
| Provider | Instruments |
6+
| --- | --- |
7+
| `ICSharpCode.Decompiler` | Decompilation pipeline: per-type/per-member decompilation, type system init, assembly resolution, whole-project decompilation, per-transform timing |
8+
| `ICSharpCode.ILSpyX` | Frontend support: assembly loading, reference resolution, search, analyzers, bundle/zip extraction, PDB loading |
9+
10+
Events are Start/Stop pairs, so trace viewers derive durations and nesting from the
11+
event timestamps. Tracing is off by default and costs nothing until a session attaches.
12+
13+
## Keywords and levels
14+
15+
Enable only what you need; the keyword masks combine with bitwise OR.
16+
17+
`ICSharpCode.Decompiler` (all = `0x1F`):
18+
19+
| Keyword | Mask | Level |
20+
| --- | --- | --- |
21+
| Decompilation (per type/member) | `0x1` | Informational (4) |
22+
| TypeSystem | `0x2` | Informational (4) |
23+
| AssemblyResolver | `0x4` | Informational (4) |
24+
| ProjectDecompiler | `0x8` | Informational (4) |
25+
| Transforms (per IL/AST transform, high volume) | `0x10` | Verbose (5) |
26+
27+
`ICSharpCode.ILSpyX` (all = `0x3F`):
28+
29+
| Keyword | Mask | Level |
30+
| --- | --- | --- |
31+
| AssemblyLoad | `0x1` | Informational (4) |
32+
| Resolver | `0x2` | Informational (4) |
33+
| Search | `0x4` | Informational (4) |
34+
| Analyzers | `0x8` | Informational (4) |
35+
| Packages (per-entry extraction is Verbose) | `0x10` | Informational (4) / Verbose (5) |
36+
| DebugInfo | `0x20` | Informational (4) |
37+
38+
Provider specs below use the `Name:KeywordMask:Level` syntax.
39+
40+
## All platforms: dotnet-trace (EventPipe)
41+
42+
Works identically on Windows, Linux and macOS.
43+
44+
```
45+
dotnet tool install --global dotnet-trace
46+
```
47+
48+
Attach to a running ILSpy instance (start ILSpy first, interact while collecting,
49+
Ctrl+C to stop):
50+
51+
```
52+
dotnet-trace ps
53+
dotnet-trace collect -p <pid> --providers "ICSharpCode.Decompiler:0x1F:5,ICSharpCode.ILSpyX:0x3F:5"
54+
```
55+
56+
Or launch ILSpy under the collector to also capture startup (assembly list loading):
57+
58+
```
59+
dotnet-trace collect --providers "ICSharpCode.Decompiler:0x1F:5,ICSharpCode.ILSpyX:0x3F:5" -- <path-to>/ILSpy
60+
```
61+
62+
Viewing the resulting `.nettrace` file:
63+
64+
- Windows: open it in PerfView (Events view) or Visual Studio.
65+
- Cross-platform: `dotnet-trace convert --format speedscope trace.nettrace` and open
66+
the output at <https://speedscope.app>, or `--format chromium` for `about:tracing`
67+
in a Chromium browser.
68+
69+
## Windows alternative: ETW
70+
71+
PerfView (`choco install perfview`) collects the same providers over ETW, which also
72+
gives you the Start/Stop duration pairing in the Events view:
73+
74+
```
75+
PerfView "/onlyProviders=*ICSharpCode.Decompiler,*ICSharpCode.ILSpyX" run ILSpy.exe
76+
```
77+
78+
Other options:
79+
80+
- `PerfView collect "/onlyProviders=..."` to attach machine-wide instead of launching.
81+
- `wpr`/Windows Performance Analyzer with a custom profile listing the two providers.

0 commit comments

Comments
 (0)