DiagnosticsPart 3
Tracing a Fixed Loop Through EventPipe Slowed It by 1.4% to 30.6%
A loop ran in 1.147 ms untraced and 1.240 ms under EventPipe's GcVerbose profile, with Allocated at 3.05 MB in both. Four runs gave 1.4% to 30.6%.

In short
- A loop that allocates 3.05 MB per operation ran in 1.147 ms with no tracing and in 1.240 ms under EventPipe's GcVerbose profile, while the Allocated column read 3.05 MB in both.
- In four runs every traced configuration was slower than the untraced one, by 1.4% to 3.9% for GcCollect and by 6.8% to 30.6% for the two verbose configurations. The size of the slowdown was not the same twice.
- The explicit high-detail provider string, which adds six more keyword groups to the GcVerbose set, was not reliably slower than GcVerbose. The order of the two changed between runs.
- Gen1 collections per 1000 operations rose from 1.9531 to 83.9844 under every traced configuration. The cause was not investigated.
- The untraced baseline drifted by about 7% across the session, so a percentage is only meaningful against a baseline from the same run.
A loop that allocates 3.05 MB per operation ran in 1.147 ms with no tracing and in 1.240 ms with EventPipe’s GcVerbose profile attached, 8.1% slower, while the Allocated column read 3.05 MB in both. Over four runs every traced configuration was slower than the untraced one, by 1.4% to 30.6%, and the size of the slowdown was not the same twice.
A trace is the dump’s moving picture. Where a managed thread dump freezes one instant of a process, an EventPipe session records a stream of events, and the process being watched pays for that stream. The figures below are that payment for one workload, with the limits of the measurement stated at the end.
Every traced configuration was slower in every run, by a different amount each time
The workload is one method with a fixed 100,000 iterations. Each iteration runs eight xorshift rounds and allocates one 32 byte Node, which is stored in a 1,024 slot ring so that it escapes and the JIT cannot place it on the stack. Four configurations ran it under BenchmarkDotNet 0.15.8, each as a separate run of the same class body. Mean time in milliseconds, with the percentage over the untraced configuration of the same run, was:
| Run | None | GcCollect | GcVerbose | Explicit provider |
|---|---|---|---|---|
| Official | 1.147 | 1.163 (+1.4%) | 1.240 (+8.1%) | 1.225 (+6.8%) |
| Repeat 1 | 1.156 | 1.187 (+2.7%) | 1.263 (+9.3%) | 1.258 (+8.8%) |
| Repeat 2 | 1.187 | 1.205 (+1.5%) | 1.296 (+9.2%) | 1.550 (+30.6%) |
| Reverse order | 1.230 | 1.278 (+3.9%) | 1.532 (+24.6%) | 1.558 (+26.7%) |
The fourth run executed the configurations in the opposite order, with the untraced one last, to test whether the first-to-run position explained the result. The untraced configuration was still the fastest. In the official run every traced Mean, less its own Error, sat above the untraced interval of 1.143 ms to 1.151 ms.
GcCollect was the cheapest in every run, and GcVerbose was above it in every run. The effect of GcVerbose ranged from 8.1% to 24.6% and that of the explicit provider from 6.8% to 30.6%. Only the direction and the order of magnitude transfer, and a percentage quoted from one run does not.
The three levels differ in a keyword mask and a level
The harness printed the providers each profiler actually enabled. GcCollect enabled Microsoft-Windows-DotNETRuntime at Informational with keywords 0x8001, which is the GC and exception groups. GcVerbose enabled the same provider at Verbose with 0x8003, which adds the GC handle group. The explicit configuration enabled it at Verbose with 0x29C01B:
new EventPipeProvider(
"Microsoft-Windows-DotNETRuntime",
EventLevel.Verbose,
(long)HighVerbosityKeywords)Relative to 0x8003, that mask adds the loader, JIT, contention, threading and type groups and the high-rate sampled object allocation events. The documentation for the dotnet-trace profiles describes gc-collect as “Tracks GC collections only at very low overhead.” and gc-verbose as “Tracks GC collections and samples object allocations.” The measured ordering agrees with those descriptions for GcCollect. It does not extend to the explicit string, which carried the most keyword groups and was not reliably the slowest.
BenchmarkDotNet also adds its own BenchmarkDotNet.EngineEventSource provider to every traced session, at Informational with all keywords, and the harness source marks it as mandatory. It is part of what tracing under this harness costs. GcCollect wrote the smallest trace in every run: 12,987,758 bytes in the official run, against 54,403,126 for GcVerbose and 51,293,186 for the explicit provider. The explicit provider, with the widest mask, wrote a smaller file than GcVerbose in two of the four runs and a larger one in the other two.
Allocated stayed at 3.05 MB while Gen1 collections rose
Allocation per operation did not change. Gen0 read 763.6719 per 1000 operations in all four configurations, and Allocated read 3.05 MB. The rows below are pasted from the untraced and the GcVerbose reports of the official run, with the header taken from the untraced one:
| Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated |
| Workload | 1.147 ms | 0.0039 ms | 0.0033 ms | 763.6719 | 1.9531 | 3.05 MB |
| Workload | 1.240 ms | 0.0233 ms | 0.0239 ms | 763.6719 | 83.9844 | 3.05 MB |Gen1 collections per 1000 operations were 1.9531 without tracing and 83.9844 under every traced configuration, in every run. The cause is not known: the trace content was not analysed, and only the file name and presence of each .nettrace were checked. What the number does show is that a traced run is not the same run with events added. The GC behaved differently, and Mean time moved with it.
One result cuts against the ordering above. In the second repeat the explicit provider reported a StdDev of 0.1015 ms, a Median of 1.597 ms and iteration times that stepped up part-way through: 1.28 ms to 1.47 ms in the first 18 iterations, then 1.56 ms to 1.65 ms in 79 of the remaining 82 (all rounded to two decimals), with the other three at 1.40 ms, 1.45 ms and 1.53 ms. Its trace was 227,561,430 bytes, about four times the size of the same configuration elsewhere. The cause was not investigated.
A percentage holds against a baseline from the same run
The untraced baseline moved from 1.147 ms to 1.156 ms to 1.187 ms to 1.230 ms across the session on one machine, about 7%. That is larger than the effect of GcCollect in any single run, 1.4% to 3.9%, so the figure for that profile is meaningful only within a run. The same-run baseline is the comparison that survives.
The measurement leaves three limits. The BenchmarkDotNet host process reads the EventPipe stream in parallel inside the same container, so part of the cost may be CPU contention with that reader and not only event emission; the two were not separated. One workload on one machine was measured. And the dotnet-trace command line was not run, so its buffer behaviour, which its reference says can drop events emitted faster than they are written, is not covered.
Run the hot path once untraced and once under the verbosity used in production, in the same session, and compare the two before trusting either number alone.
Measured on .NET 10.0.12, SDK 10.0.401, Linux arm64 (Ubuntu 24.04) in a Docker container with the network disabled and no CPU or memory limit, with 12 CPUs visible to the container and workstation GC in the host process. BenchmarkDotNet 0.15.8 with DefaultJob and [MemoryDiagnoser] ran four separate configurations, each with at most one EventPipeProfiler, built with performExtraBenchmarksRun: false so that the measured iterations are the traced ones. The official run was followed by two repeats and one reverse-order control, all on the same container image, in a fixed order apart from the control. The procedure cannot see trace content, event counts per provider, or any effect outside Mean and the memory columns, and dotnet-trace 10.0.745401, present in the image, was not used for these figures. The profile descriptions quoted are from the dotnet-trace reference page, read on 18 October 2026.
Frequently asked
Questions this raises
Does EventPipe tracing change how much a benchmark allocates?
Not in this measurement. Allocated read 3.05 MB per operation and Gen0 read 763.6719 per 1000 operations in all four configurations. The Gen1 column did change, from 1.9531 to 83.9844 per 1000 operations.
Is the GcCollect profile cheap enough to leave attached?
It was the cheapest configuration in all four runs, at 1.4% to 3.9% over its own untraced baseline. That is smaller than the 7% the baseline drifted between runs, so the figure only holds within a single run.
Does a more detailed provider string always cost more?
No. The explicit string with six more keyword groups than GcVerbose was 1.225 ms against 1.240 ms in the official run, and 1.550 ms against 1.296 ms in one repeat. Its position relative to GcVerbose changed between runs.
Was dotnet-trace itself measured?
No. The tracing was applied through the EventPipeProfiler diagnoser of BenchmarkDotNet 0.15.8, which reads the same runtime provider. The dotnet-trace command line was not run for these figures.


