C
C#15mo ago
etet2

❔ Profiling Multithreading

i am extensively using multi-threading and locks in my project. After a recent overhaul some cascading cycle of cause and effect caused some an issue where the code spends 70% of the time waiting for locks to free up rather than actually doing things. How could i go about finding the exact lines where the code is waiting? The best thing i can think of is to go around removing locks and seeing the effect on performance but that would just crash the program with various excetiptions with regards to access to collections and such
3 Replies
n8ta
n8ta15mo ago
One way to continue would be generate a dump of the process and then look at each thread's stack and see if you can suss out what each thread is waiting for. https://learn.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-dump You can open that dump file in visual studio. Looks like there's also dotnet-dump analyze but I've never used that.
dotnet-dump diagnostic tool - .NET CLI - .NET
Learn how to install and use the dotnet-dump CLI tool to collect and analyze Windows and Linux dumps without any native debugger.
etet2
etet2OP15mo ago
ill give that a shot
Accord
Accord15mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server