Skip to content

Comments

[Profiler] Generate reference chain#8225

Open
chrisnas wants to merge 3 commits intomasterfrom
chrisnas/reference_chain
Open

[Profiler] Generate reference chain#8225
chrisnas wants to merge 3 commits intomasterfrom
chrisnas/reference_chain

Conversation

@chrisnas
Copy link
Contributor

Summary of changes

Generate reference chain at type level

Reason for change

Last step to help pointing out memory leaks root cause (i.e. which root is responsible for keeping instances alive)

Implementation details

Listen to GC_BULK_ROOT_STATIC_VAR and GC_BULK_ROOT_EDGE to get the different kinds of root. Next, traverse the reference fields down to a leak (i.e. non reference object). The reference chain is kept at the type level to avoid consumming to much memory and serialized in .json format to be sent with profile data.

Test coverage

Unit tests and integration tests have been added.

Other details

@chrisnas chrisnas requested a review from a team as a code owner February 20, 2026 10:55
@github-actions github-actions bot added the area:profiler Issues related to the continous-profiler label Feb 20, 2026
@dd-trace-dotnet-ci-bot
Copy link

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (8225) and master.

✅ No regressions detected - check the details below

Full Metrics Comparison

FakeDbCommand

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration74.39 ± (74.38 - 74.73) ms74.89 ± (74.94 - 75.26) ms+0.7%✅⬆️
.NET Framework 4.8 - Bailout
duration79.27 ± (79.07 - 79.45) ms79.57 ± (79.45 - 79.80) ms+0.4%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1075.93 ± (1076.04 - 1081.62) ms1082.11 ± (1083.04 - 1088.47) ms+0.6%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms22.78 ± (22.74 - 22.83) ms22.91 ± (22.88 - 22.95) ms+0.6%✅⬆️
process.time_to_main_ms85.71 ± (85.49 - 85.93) ms86.77 ± (86.59 - 86.95) ms+1.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.93 ± (10.92 - 10.93) MB10.90 ± (10.90 - 10.90) MB-0.2%
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms22.71 ± (22.67 - 22.76) ms22.97 ± (22.91 - 23.02) ms+1.1%✅⬆️
process.time_to_main_ms87.22 ± (87.00 - 87.43) ms88.33 ± (88.12 - 88.53) ms+1.3%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.95 ± (10.94 - 10.95) MB10.94 ± (10.93 - 10.94) MB-0.1%
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms237.93 ± (233.96 - 241.89) ms238.63 ± (234.33 - 242.93) ms+0.3%✅⬆️
process.time_to_main_ms491.11 ± (490.39 - 491.83) ms495.47 ± (494.75 - 496.20) ms+0.9%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed47.63 ± (47.61 - 47.65) MB47.59 ± (47.56 - 47.61) MB-0.1%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.2%
.NET 6 - Baseline
process.internal_duration_ms21.44 ± (21.40 - 21.49) ms21.72 ± (21.68 - 21.76) ms+1.3%✅⬆️
process.time_to_main_ms74.15 ± (73.99 - 74.31) ms75.69 ± (75.52 - 75.86) ms+2.1%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.63 ± (10.62 - 10.63) MB10.63 ± (10.63 - 10.63) MB+0.1%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms21.42 ± (21.36 - 21.47) ms21.78 ± (21.73 - 21.84) ms+1.7%✅⬆️
process.time_to_main_ms76.10 ± (75.91 - 76.29) ms77.63 ± (77.44 - 77.82) ms+2.0%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.67 ± (10.67 - 10.68) MB10.74 ± (10.73 - 10.74) MB+0.6%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms254.10 ± (250.50 - 257.71) ms257.82 ± (254.69 - 260.96) ms+1.5%✅⬆️
process.time_to_main_ms472.83 ± (472.12 - 473.54) ms476.92 ± (476.24 - 477.59) ms+0.9%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.37 ± (48.35 - 48.39) MB48.36 ± (48.34 - 48.39) MB-0.0%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.1%
.NET 8 - Baseline
process.internal_duration_ms19.56 ± (19.52 - 19.61) ms19.91 ± (19.87 - 19.95) ms+1.8%✅⬆️
process.time_to_main_ms73.27 ± (73.11 - 73.43) ms75.53 ± (75.36 - 75.70) ms+3.1%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.69 ± (7.68 - 7.69) MB7.67 ± (7.66 - 7.68) MB-0.2%
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms19.58 ± (19.53 - 19.63) ms20.02 ± (19.98 - 20.06) ms+2.2%✅⬆️
process.time_to_main_ms74.58 ± (74.42 - 74.74) ms76.99 ± (76.79 - 77.18) ms+3.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.72 ± (7.71 - 7.72) MB7.72 ± (7.71 - 7.72) MB-0.0%
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms188.17 ± (187.22 - 189.12) ms190.32 ± (189.56 - 191.08) ms+1.1%✅⬆️
process.time_to_main_ms450.45 ± (449.65 - 451.25) ms460.45 ± (459.74 - 461.17) ms+2.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed35.97 ± (35.93 - 36.00) MB36.11 ± (36.07 - 36.15) MB+0.4%✅⬆️
runtime.dotnet.threads.count27 ± (27 - 27)27 ± (27 - 27)-0.3%

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration194.22 ± (196.11 - 198.56) ms193.88 ± (193.95 - 194.72) ms-0.2%
.NET Framework 4.8 - Bailout
duration198.35 ± (198.18 - 198.85) ms196.73 ± (196.51 - 197.13) ms-0.8%
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1139.21 ± (1140.45 - 1148.21) ms1139.82 ± (1142.68 - 1151.79) ms+0.1%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms189.42 ± (189.00 - 189.84) ms188.18 ± (187.93 - 188.43) ms-0.7%
process.time_to_main_ms81.82 ± (81.61 - 82.04) ms81.66 ± (81.40 - 81.91) ms-0.2%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.05 ± (16.03 - 16.07) MB16.07 ± (16.05 - 16.10) MB+0.1%✅⬆️
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (19 - 20)-0.2%
.NET Core 3.1 - Bailout
process.internal_duration_ms187.83 ± (187.54 - 188.13) ms187.38 ± (187.09 - 187.67) ms-0.2%
process.time_to_main_ms82.75 ± (82.58 - 82.93) ms82.84 ± (82.70 - 82.98) ms+0.1%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.12 ± (16.09 - 16.15) MB16.22 ± (16.19 - 16.25) MB+0.6%✅⬆️
runtime.dotnet.threads.count20 ± (20 - 21)21 ± (21 - 21)+1.4%✅⬆️
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms440.07 ± (437.86 - 442.29) ms436.59 ± (434.77 - 438.40) ms-0.8%
process.time_to_main_ms474.62 ± (474.16 - 475.07) ms474.11 ± (473.51 - 474.71) ms-0.1%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed57.82 ± (57.70 - 57.94) MB58.18 ± (58.07 - 58.29) MB+0.6%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 30)29 ± (29 - 30)+0.0%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms192.20 ± (191.82 - 192.59) ms192.02 ± (191.66 - 192.38) ms-0.1%
process.time_to_main_ms70.60 ± (70.40 - 70.80) ms70.40 ± (70.23 - 70.56) ms-0.3%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed15.88 ± (15.72 - 16.04) MB16.36 ± (16.25 - 16.46) MB+3.0%✅⬆️
runtime.dotnet.threads.count18 ± (18 - 18)19 ± (19 - 19)+4.4%✅⬆️
.NET 6 - Bailout
process.internal_duration_ms191.61 ± (191.33 - 191.90) ms191.43 ± (191.16 - 191.71) ms-0.1%
process.time_to_main_ms71.59 ± (71.46 - 71.71) ms71.45 ± (71.31 - 71.58) ms-0.2%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.37 ± (16.29 - 16.46) MB16.24 ± (16.12 - 16.37) MB-0.8%
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (19 - 20)-0.8%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms450.93 ± (449.04 - 452.81) ms453.11 ± (451.48 - 454.74) ms+0.5%✅⬆️
process.time_to_main_ms450.26 ± (449.69 - 450.83) ms449.45 ± (448.88 - 450.03) ms-0.2%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed58.03 ± (57.92 - 58.14) MB57.93 ± (57.83 - 58.03) MB-0.2%
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)-0.1%
.NET 8 - Baseline
process.internal_duration_ms190.83 ± (190.48 - 191.17) ms193.69 ± (193.22 - 194.16) ms+1.5%✅⬆️
process.time_to_main_ms70.34 ± (70.12 - 70.57) ms71.06 ± (70.91 - 71.22) ms+1.0%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.72 ± (11.70 - 11.74) MB11.74 ± (11.72 - 11.76) MB+0.2%✅⬆️
runtime.dotnet.threads.count18 ± (18 - 18)18 ± (18 - 18)-0.1%
.NET 8 - Bailout
process.internal_duration_ms190.05 ± (189.71 - 190.40) ms192.50 ± (192.13 - 192.87) ms+1.3%✅⬆️
process.time_to_main_ms70.94 ± (70.80 - 71.09) ms72.28 ± (72.11 - 72.45) ms+1.9%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.80 ± (11.78 - 11.83) MB11.79 ± (11.76 - 11.81) MB-0.1%
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)+0.1%✅⬆️
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms363.58 ± (362.11 - 365.04) ms373.29 ± (371.76 - 374.82) ms+2.7%✅⬆️
process.time_to_main_ms433.57 ± (432.96 - 434.18) ms445.72 ± (444.82 - 446.63) ms+2.8%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed47.84 ± (47.80 - 47.88) MB47.78 ± (47.75 - 47.82) MB-0.1%
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)-0.2%
Comparison explanation

Execution-time benchmarks measure the whole time it takes to execute a program, and are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are highlighted in **red**. The following thresholds were used for comparing the execution times:

  • Welch test with statistical test for significance of 5%
  • Only results indicating a difference greater than 5% and 5 ms are considered.

Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard.

Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph).

Duration charts
FakeDbCommand (.NET Framework 4.8)
gantt
    title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8225) - mean (75ms)  : 73, 77
    master - mean (75ms)  : 72, 77

    section Bailout
    This PR (8225) - mean (80ms)  : 78, 82
    master - mean (79ms)  : 77, 81

    section CallTarget+Inlining+NGEN
    This PR (8225) - mean (1,086ms)  : 1047, 1124
    master - mean (1,079ms)  : 1039, 1118

Loading
FakeDbCommand (.NET Core 3.1)
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8225) - mean (117ms)  : 114, 120
    master - mean (115ms)  : 111, 120

    section Bailout
    This PR (8225) - mean (118ms)  : 116, 121
    master - mean (117ms)  : 114, 120

    section CallTarget+Inlining+NGEN
    This PR (8225) - mean (772ms)  : 702, 842
    master - mean (763ms)  : 706, 820

Loading
FakeDbCommand (.NET 6)
gantt
    title Execution time (ms) FakeDbCommand (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8225) - mean (104ms)  : 101, 107
    master - mean (102ms)  : 99, 105

    section Bailout
    This PR (8225) - mean (106ms)  : 104, 108
    master - mean (104ms)  : 101, 107

    section CallTarget+Inlining+NGEN
    This PR (8225) - mean (771ms)  : 710, 831
    master - mean (759ms)  : 700, 819

Loading
FakeDbCommand (.NET 8)
gantt
    title Execution time (ms) FakeDbCommand (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8225) - mean (104ms)  : 101, 106
    master - mean (101ms)  : 98, 103

    section Bailout
    This PR (8225) - mean (105ms)  : 103, 108
    master - mean (102ms)  : 99, 105

    section CallTarget+Inlining+NGEN
    This PR (8225) - mean (691ms)  : 671, 711
    master - mean (666ms)  : 654, 679

Loading
HttpMessageHandler (.NET Framework 4.8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8225) - mean (194ms)  : 190, 198
    master - mean (197ms)  : 180, 215

    section Bailout
    This PR (8225) - mean (197ms)  : 194, 200
    master - mean (199ms)  : 195, 202

    section CallTarget+Inlining+NGEN
    This PR (8225) - mean (1,147ms)  : 1078, 1216
    master - mean (1,144ms)  : 1087, 1202

Loading
HttpMessageHandler (.NET Core 3.1)
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8225) - mean (279ms)  : 275, 283
    master - mean (280ms)  : 272, 287

    section Bailout
    This PR (8225) - mean (279ms)  : 275, 282
    master - mean (279ms)  : 275, 283

    section CallTarget+Inlining+NGEN
    This PR (8225) - mean (938ms)  : 895, 982
    master - mean (944ms)  : 909, 980

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8225) - mean (271ms)  : 266, 275
    master - mean (271ms)  : 266, 276

    section Bailout
    This PR (8225) - mean (271ms)  : 267, 275
    master - mean (271ms)  : 267, 275

    section CallTarget+Inlining+NGEN
    This PR (8225) - mean (931ms)  : 904, 959
    master - mean (931ms)  : 909, 954

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8225) - mean (275ms)  : 266, 284
    master - mean (271ms)  : 266, 276

    section Bailout
    This PR (8225) - mean (275ms)  : 270, 279
    master - mean (270ms)  : 266, 275

    section CallTarget+Inlining+NGEN
    This PR (8225) - mean (852ms)  : 816, 888
    master - mean (828ms)  : 809, 846

Loading

@pr-commenter
Copy link

pr-commenter bot commented Feb 20, 2026

Benchmarks

Benchmark execution time: 2026-02-20 12:09:26

Comparing candidate commit 1b8f20c in PR branch chrisnas/reference_chain with baseline commit 8941a2d in branch master.

Found 3 performance improvements and 9 performance regressions! Performance is the same for 161 metrics, 19 unstable metrics.

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • 🟥 execution_time [+100.345ms; +100.626ms] or [+98.053%; +98.327%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody netcoreapp3.1

  • 🟥 execution_time [+20.815ms; +26.650ms] or [+10.568%; +13.531%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net6.0

  • 🟥 execution_time [+18.802ms; +23.986ms] or [+9.689%; +12.360%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs netcoreapp3.1

  • 🟩 execution_time [-22.502ms; -21.834ms] or [-11.178%; -10.846%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 throughput [-95.159op/s; -71.404op/s] or [-7.962%; -5.975%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • 🟩 execution_time [-37.027ms; -35.595ms] or [-19.232%; -18.488%]
  • 🟩 throughput [+117.667op/s; +129.397op/s] or [+8.328%; +9.159%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟥 execution_time [+18.698ms; +24.797ms] or [+12.635%; +16.756%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net6.0

  • 🟥 execution_time [+117.817µs; +123.463µs] or [+8.585%; +8.996%]
  • 🟥 throughput [-60.205op/s; -57.544op/s] or [-8.262%; -7.897%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore netcoreapp3.1

  • 🟥 throughput [-16045159.293op/s; -14913093.083op/s] or [-6.653%; -6.183%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net6.0

  • 🟥 execution_time [+15.831ms; +19.720ms] or [+7.886%; +9.823%]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:profiler Issues related to the continous-profiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant