Options

Follow context switches in a trace?

I was just trying to profile an issue where our GUI would just sit there and do nothing for a minute, then finally start to do what it was told to do.

(This is in a top-down Call Tree view with All Methods and All Threads)
The trace led me to a "(Waiting for synchronization)" block caused by Task.Wait; which some frames up gets called inside the Delegate of Task.Factory.StartNew(...). I can get up until that (in my case) anonymous method in my code, which then only goes up into System.Threading.ThreadPoolWorkQueue.Dispatch.

From there, I cannot find the corresponding other thread that called this Task.Factory.StartNew; switching thread-by-thread is also very difficult since this is a method being called very often throughout the application. And here I'm just interrested in this particular path with the long waiting time.

Any tricks or other thoughts on how I could find the related stack/thread for this?
Visual Studio is able to track context switches and show the related threads in source (also for Tasks), so I'm wondering if the profiler couldn't just do something similar and perhaps even piece together those stacks to make browsing a little easier?

Thanks,
Emanuel
Sign In or Register to comment.