Is it possible using the VS2010 profiler to sample a thread other than the Main Thread in C#

徘徊边缘 提交于 2019-12-11 14:47:23

问题


I'm trying to profile an app in c#, never done any kind of profiling before. I haven't been able to find much documentation on the profiler so far maybe someone here might know better.

I have an app that when I click a toolbar button, kicks off a background thread to fetch me some data. The data is then prepared and displayed on the Main thread. I'm trying to profile this process to determine whether the time taken is in the preparation of the data or in the fetching, but I'm not having much luck. If I use the Sampling mode, it only displays the Main thread, if I use the Concurrency view, it gives me a load of information that I'm not after like contention etc.

Cheers if anyone knows something that could help!

Alex


回答1:


The VS sampler is suspended during I/O, so if a thread spends nearly all its time in I/O, it will appear to be spending almost no time at all. On the other hand, instrumentation should catch it.

My favorite method is to just pause it while it's working, and examine any thread you like.



来源:https://stackoverflow.com/questions/3118339/is-it-possible-using-the-vs2010-profiler-to-sample-a-thread-other-than-the-main

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!