Skip to content

Commit f0a778b

Browse files
authored
perf: subscribe only to necessary CLR events (#3970)
* perf: subscribe only to necessary CLR events * chore: changelog * Update CHANGELOG.md
1 parent 1d2df6d commit f0a778b

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
### Enhancements
6+
7+
- Profiling: improve performance by subscribing only to necessary CLR events ([#3970](https://github.com/getsentry/sentry-dotnet/pull/3970))
8+
59
### Fixes
610

711
- Unknown stack frames in profiles on .NET 8+ ([#3967](https://github.com/getsentry/sentry-dotnet/pull/3967))

src/Sentry.Profiling/SampleProfilerSession.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ private SampleProfilerSession(SentryStopwatch stopwatch, EventPipeSession sessio
3131
// Exposed only for benchmarks.
3232
internal static EventPipeProvider[] Providers = new[]
3333
{
34-
// Note: all events we need issued by "DotNETRuntime" provider are at "EventLevel.Informational"
35-
// see https://learn.microsoft.com/en-us/dotnet/fundamentals/diagnostics/runtime-events
36-
// TODO replace Keywords.Default with a subset. Currently it is:
37-
// Default = GC | Type | GCHeapSurvivalAndMovement | Binder | Loader | Jit | NGen | SupressNGen
38-
// | StopEnumeration | Security | AppDomainResourceManagement | Exception | Threading | Contention | Stack | JittedMethodILToNativeMap
39-
// | ThreadTransfer | GCHeapAndTypeNames | Codesymbols | Compilation,
40-
new EventPipeProvider(ClrTraceEventParser.ProviderName, EventLevel.Verbose, (long) ClrTraceEventParser.Keywords.Default),
34+
new EventPipeProvider(ClrTraceEventParser.ProviderName, EventLevel.Verbose, (long) (
35+
ClrTraceEventParser.Keywords.Jit
36+
| ClrTraceEventParser.Keywords.NGen
37+
| ClrTraceEventParser.Keywords.Loader
38+
| ClrTraceEventParser.Keywords.Binder
39+
| ClrTraceEventParser.Keywords.JittedMethodILToNativeMap
40+
)),
4141
new EventPipeProvider(SampleProfilerTraceEventParser.ProviderName, EventLevel.Informational),
4242
// new EventPipeProvider(TplEtwProviderTraceEventParser.ProviderName, EventLevel.Informational, (long) TplEtwProviderTraceEventParser.Keywords.Default)
4343
};

0 commit comments

Comments
 (0)