-
Notifications
You must be signed in to change notification settings - Fork 143
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] Implement WaitHandle wait duration profiling #6426
base: master
Are you sure you want to change the base?
Conversation
Datadog ReportBranch report: ✅ 0 Failed, 218707 Passed, 1502 Skipped, 12h 31m 13.32s Total Time |
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 (6426) - mean (69ms) : 65, 73
. : milestone, 69,
master - mean (68ms) : 65, 71
. : milestone, 68,
section CallTarget+Inlining+NGEN
This PR (6426) - mean (980ms) : 953, 1007
. : milestone, 980,
master - mean (975ms) : 954, 996
. : milestone, 975,
gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6426) - mean (107ms) : 105, 110
. : milestone, 107,
master - mean (108ms) : 105, 110
. : milestone, 108,
section CallTarget+Inlining+NGEN
This PR (6426) - mean (674ms) : 658, 690
. : milestone, 674,
master - mean (676ms) : 659, 693
. : milestone, 676,
gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6426) - mean (91ms) : 89, 93
. : milestone, 91,
master - mean (91ms) : 89, 93
. : milestone, 91,
section CallTarget+Inlining+NGEN
This PR (6426) - mean (631ms) : 617, 645
. : milestone, 631,
master - mean (635ms) : 617, 652
. : milestone, 635,
gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6426) - mean (193ms) : 189, 197
. : milestone, 193,
master - mean (194ms) : 190, 198
. : milestone, 194,
section CallTarget+Inlining+NGEN
This PR (6426) - mean (1,095ms) : 1071, 1119
. : milestone, 1095,
master - mean (1,102ms) : 1071, 1133
. : milestone, 1102,
gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6426) - mean (278ms) : 274, 283
. : milestone, 278,
master - mean (278ms) : 273, 283
. : milestone, 278,
section CallTarget+Inlining+NGEN
This PR (6426) - mean (869ms) : 830, 908
. : milestone, 869,
master - mean (870ms) : 838, 901
. : milestone, 870,
gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6426) - mean (266ms) : 261, 270
. : milestone, 266,
master - mean (267ms) : 263, 271
. : milestone, 267,
section CallTarget+Inlining+NGEN
This PR (6426) - mean (843ms) : 816, 869
. : milestone, 843,
master - mean (854ms) : 815, 892
. : milestone, 854,
|
currentThreadInfo->SetWaitStart(0ns); | ||
|
||
// We are not interested in waits that are too short | ||
if (waitDuration < 1ms) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this. Assuming a memcache request takes 300 us to complete, we would miss all sync-over-async on them, even though it could be a very serious issue.
What would be the issue with not filtering any waits?
return; | ||
} | ||
|
||
AddContentionSample(0ns, -1, currentThreadInfo->GetWaitType(), waitDuration, 0, WStr(""), _emptyStack); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it mean the wait events be branded as contention? I'm not sure sync-over-async can be considered as contention.
Summary of changes
Listen to .NET 9+ events related to WaitHandle-derivated instances to profile wait durations
Reason for change
R&D week based on dotnet/runtime#94737 and #5814
Implementation details
Listen to WaitHandleWaitStart/WaitHandleWaitStop events to measure wait duration and, if possible, get the type of wait object like Mutex, Semaphore, ManualResetEvent or AutoResetEvent
Test coverage
Other details