dotnet-monitor icon indicating copy to clipboard operation
dotnet-monitor copied to clipboard

Enable collection of stacks from a running process

Open willpe opened this issue 3 years ago • 2 comments

  • Similar to dotnet-stacks
  • Talk to @davmason about DoStackSnapshot, should return stacks for all threads
  • Could serve up as a new API

willpe avatar Jan 18 '22 19:01 willpe

https://github.com/dotnet/samples/tree/main/core/profiling/stacksampling

wiktork avatar Jan 20 '22 19:01 wiktork

That is a good starting point, but it is not super performant. It suspends the runtime and samples all threads on a regular basis, but runtime suspension can be costly. We don't have a super good story for doing it the performant way, you would have to pause threads one by one (SuspendThread on Windows, signal handler on Linux) and then work through all the potential deadlocks that happen if you suspend a thread that's holding the allocation lock or loader lock

davmason avatar Jan 20 '22 19:01 davmason