Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS 2010 Performance Explorer

I'm starting to explore performance profiler in VS 2010 and having a hard time finding it useful. I realize this is most likely because I'm not familiar with the tool.

What I'm looking for is a way to identify the most time consuming method calls. A lot of the times it will just identify ASP.NET methods as the worst offenders, like ProcessRequest and etc. and its hard to narrow it down to the actual method that is taking so long.

I would like to just identify the calls within my code that are taking the longest to execute.

Any pointers would be appreciated. Thanks!

like image 728
AVP06 Avatar asked Nov 05 '22 00:11

AVP06


1 Answers

I know this is an old question, but a few tips which I hope will help you or others:

Starting with Profiler paused.

This allows you to just profile the single page you want to focus on, and cut out the noise from the application firing up, home page loading, navigating to what you want to profile, etc.

  • From the menu, choose Analyze > Profiler > Start with Profiler Paused
  • Then navigate in your website to the point just before the page you want to profile
  • Now in VS2010 on the profiler page click 'Resume' to start profiling
  • Back on your website, click the link or button etc. to load the page you want to profile
  • Wait for it to load, then back in VS2010, click 'Stop Profiling'
  • After a few moments your profile summary will load.

Finding the bottlenecks using the 'Hot Path'

  • Once the profile summary has loaded, change the current view to Call Tree
  • Click 'Expand Hot Path' (button with a flame icon)
  • This will show you the worst time consuming function, and the call stack leading up to it

Interpreting the data

  • The second column of figures ('Elapsed Exclusive Time') shows you the time spent in this particular function (method etc) excluding calls it makes to other functions.
  • The second to last column ('Number of Calls') says how many times this particular function was called.
  • A combination of these two columns can be a big clue as to where a bottleneck lies.
  • For instance, you might find that a System.Linq.Queryable.[something] function is taking a big chunk of the overall time and is being called 10's or 100's of times... If so, it's possible that refining your code to streamline it so you reduce the overall number of calls will help...
  • Walking back up the tree will tell you which function instigated the calls into this bottleneck function and in turn, which function called that function and so on.

From this you should at least be able to identify where any bottlenecks in performance are, and why they are happening. Often, the next challenge is to come up with a more refined way of achieving the same result with less calls to time-consuming functions, database calls, IO operations, etc.

I hope this helps as a starter for you or others who come across this (common) question.

like image 148
Chris Avatar answered Nov 10 '22 15:11

Chris