-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Profiler] Fix Windows 64 bit stack walking #6583
Conversation
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing the following branches/commits: 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 shown in red. The following thresholds were used for comparing the execution times:
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). gantt
title Execution time (ms) FakeDbCommand (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6583) - mean (69ms) : 66, 73
. : milestone, 69,
master - mean (69ms) : 66, 72
. : milestone, 69,
section CallTarget+Inlining+NGEN
This PR (6583) - mean (982ms) : 956, 1008
. : milestone, 982,
master - mean (985ms) : 961, 1010
. : milestone, 985,
gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6583) - mean (108ms) : 106, 110
. : milestone, 108,
master - mean (109ms) : 106, 111
. : milestone, 109,
section CallTarget+Inlining+NGEN
This PR (6583) - mean (684ms) : 667, 702
. : milestone, 684,
master - mean (684ms) : 667, 701
. : milestone, 684,
gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6583) - mean (92ms) : 90, 93
. : milestone, 92,
master - mean (92ms) : 90, 93
. : milestone, 92,
section CallTarget+Inlining+NGEN
This PR (6583) - mean (638ms) : 621, 654
. : milestone, 638,
master - mean (635ms) : 619, 650
. : milestone, 635,
gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6583) - mean (189ms) : 186, 193
. : milestone, 189,
master - mean (189ms) : 186, 193
. : milestone, 189,
section CallTarget+Inlining+NGEN
This PR (6583) - mean (1,093ms) : 1059, 1128
. : milestone, 1093,
master - mean (1,087ms) : 1062, 1113
. : milestone, 1087,
gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6583) - mean (276ms) : 271, 281
. : milestone, 276,
master - mean (275ms) : 271, 280
. : milestone, 275,
section CallTarget+Inlining+NGEN
This PR (6583) - mean (873ms) : 844, 901
. : milestone, 873,
master - mean (874ms) : 845, 903
. : milestone, 874,
gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6583) - mean (264ms) : 261, 268
. : milestone, 264,
master - mean (265ms) : 262, 268
. : milestone, 265,
section CallTarget+Inlining+NGEN
This PR (6583) - mean (849ms) : 818, 881
. : milestone, 849,
master - mean (854ms) : 823, 884
. : milestone, 854,
|
Datadog ReportBranch report: ✅ 0 Failed, 248670 Passed, 2470 Skipped, 20h 52m 23.58s Total Time |
Benchmarks Report for tracer 🐌Benchmarks for #6583 compared to master:
The following thresholds were used for comparing the benchmark speeds:
Allocation changes below 0.5% are ignored. Benchmark detailsBenchmarks.Trace.ActivityBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.SpanBenchmark - Faster 🎉 Same allocations ✔️
|
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0 | 1.147 | 452.77 | 394.85 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | StartFinishSpan |
net6.0 | 452ns | 0.614ns | 2.38ns | 0.00813 | 0 | 0 | 576 B |
master | StartFinishSpan |
netcoreapp3.1 | 564ns | 0.835ns | 3.01ns | 0.00773 | 0 | 0 | 576 B |
master | StartFinishSpan |
net472 | 600ns | 1.25ns | 4.84ns | 0.0918 | 0 | 0 | 578 B |
master | StartFinishScope |
net6.0 | 536ns | 0.73ns | 2.83ns | 0.00984 | 0 | 0 | 696 B |
master | StartFinishScope |
netcoreapp3.1 | 687ns | 1.67ns | 6.48ns | 0.00963 | 0 | 0 | 696 B |
master | StartFinishScope |
net472 | 868ns | 1.77ns | 6.84ns | 0.104 | 0 | 0 | 658 B |
#6583 | StartFinishSpan |
net6.0 | 396ns | 0.754ns | 2.92ns | 0.00814 | 0 | 0 | 576 B |
#6583 | StartFinishSpan |
netcoreapp3.1 | 590ns | 1.1ns | 4.26ns | 0.0079 | 0 | 0 | 576 B |
#6583 | StartFinishSpan |
net472 | 625ns | 0.984ns | 3.81ns | 0.0916 | 0 | 0 | 578 B |
#6583 | StartFinishScope |
net6.0 | 565ns | 0.474ns | 1.84ns | 0.00988 | 0 | 0 | 696 B |
#6583 | StartFinishScope |
netcoreapp3.1 | 698ns | 1.57ns | 6.07ns | 0.00944 | 0 | 0 | 696 B |
#6583 | StartFinishScope |
net472 | 802ns | 1.84ns | 7.13ns | 0.104 | 0 | 0 | 658 B |
Benchmarks.Trace.TraceAnnotationsBenchmark - Slower ⚠️ Same allocations ✔️
Slower ⚠️ in #6583
Benchmark
diff/base
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑netcoreapp3.1
1.187
851.90
1,010.80
Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑netcoreapp3.1 | 1.187 | 851.90 | 1,010.80 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | RunOnMethodBegin |
net6.0 | 626ns | 0.918ns | 3.56ns | 0.00978 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
netcoreapp3.1 | 853ns | 1.3ns | 5.02ns | 0.00942 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
net472 | 1.02μs | 2ns | 7.73ns | 0.104 | 0 | 0 | 658 B |
#6583 | RunOnMethodBegin |
net6.0 | 640ns | 1.1ns | 4.11ns | 0.00993 | 0 | 0 | 696 B |
#6583 | RunOnMethodBegin |
netcoreapp3.1 | 1.01μs | 1.62ns | 5.61ns | 0.00957 | 0 | 0 | 696 B |
#6583 | RunOnMethodBegin |
net472 | 1.04μs | 2.41ns | 9.33ns | 0.104 | 0 | 0 | 658 B |
## Summary of changes Fix Windows 64 bit stack walking code ## Reason for change On Windows, 64 bit stack walking failed (maybe after a Visual Studio update). After investigating, it was due to fact that the execution context was retrieved in a function that was inlined before. Since this context is then used in the same method to iterate on different frames, then the stack should not be updated (i.e. not returning from a function call). The existing code should have always failed but a previous version of the compiler probably decided to inline it. And this is no more the case for VS 17.12. ## Implementation details Move the context retrieval code in the same function that walk the stack ## Test coverage Already covered in all providers that walk the stack ## Other details <!-- Fixes #{issue} --> <!--⚠️ Note: where possible, please obtain 2 approvals prior to merging. Unless CODEOWNERS specifies otherwise, for external teams it is typically best to have one review from a team member, and one review from apm-dotnet. Trivial changes do not require 2 reviews. -->
Summary of changes
Fix Windows 64 bit stack walking code
Reason for change
On Windows, 64 bit stack walking failed (maybe after a Visual Studio update). After investigating, it was due to fact that the execution context was retrieved in a function that was inlined before. Since this context is then used in the same method to iterate on different frames, then the stack should not be updated (i.e. not returning from a function call).
The existing code should have always failed but a previous version of the compiler probably decided to inline it. And this is no more the case for VS 17.12.
Implementation details
Move the context retrieval code in the same function that walk the stack
Test coverage
Already covered in all providers that walk the stack
Other details