Closed verdie-g closed 2 months ago
Make sure that it works with all known thread pool implementations.
The symbol name method looks fragile, I thought the first method name of the stack trace would always be System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart
but I also found:
System.Threading.Thread.StartCallback
System.Threading.Tasks.Task.RunContinuations
System.Threading.Tasks.ContinueWithTaskContinuation.Run
System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction
System.Threading.Tasks.Task.ExecuteWithThreadLocal
Though in a prod trace I could see that 79% of the stack traces started with System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart
so it could still give some interesting info.
System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart: 1196557 (78.848045%)
System.Threading.Thread.StartCallback: 95350 (6.283162%)
System.Threading.Tasks.Task.RunContinuations: 34774 (2.2914596%)
System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction: 31615 (2.0832949%)
System.Threading.ExecutionContext.RunInternal: 29485 (1.9429369%)
System.Runtime.CompilerServices.TaskAwaiter+<>c.<OutputWaitEtwEvents>b__12_0: 20719 (1.3652946%)
System.Threading.ThreadPoolWorkQueue.Dispatch: 11157 (0.73519915%)
Aerospike.Client.AsyncConnectionArgs.ReceiveEvent: 7410 (0.4882877%)
Criteo.RTB.Service.ResponseContext.OnCancellation: 7211 (0.47517443%)
Aerospike.Client.AsyncConnectionArgs.AsyncCompleted: 6593 (0.43445083%)
A filter to only show stacks originating from a thread pool thread. That's useful for thread starvation scenarios. It could be detected by looking at the symbol names of the stacks or maybe an event already contain the info if a thread id is from the thread pool.