Pinpoint a performance issue using hotpath in Visual Studio 2008
Analyzing a performance report
When you first open a performance report in Visual Studio 90% of the time the question on your mind is “where is my program spending most of its time?” In Visual Studio 2005 the best way to find this was to move to the calltree view and from there to follow the execution path with high inclusive functions down the tree. If you are not familiar with the calltree view, this view places all the execution paths of your program into one big tree structure. In this tree you can see both inclusive and exclusive values for either samples (in sampling mode) or time (in instrumentation mode). In a nutshell, inclusive means “functions that caused work” so any inclusive time or samples for a function can be attributed to that function or any of its sub-functions. On the other hand, exclusive values can be attributed only to that function and do not include any values from sub-functions.
So with the above explanation the way to find out where your program is spending most of its time is to drill down the tree and whenever you have a choice between children of a function pick the child with the highest inclusive value (meaning that it is doing more work below it then the other children). Eventually you will reach some functions with high exclusive values, which are the functions that are actually doing the most work in your program. At that point you can examine those functions and the path taken to them and start working to fix your performance issue.
Hotpath
The problem with the above scenario is that, quite frankly, it’s a pain in the butt to have to always drill down on the tree to find these hot functions and hot paths. Especially with sampling reports the calltree can be many levels deep and it can take a while to get to the functions of interest. So for Visual Studio 2008 we’ve added a small, but very useful feature called “Hotpath” to automate this scenario. Now when you open a performance report and move to the calltree view you will see a small flame icon located in the toolbar. When you push this button it will expand the hot path from the root following the rules that we mentioned above (following the high inclusive numbers when choosing between children). In the example seen below I’ve run a profiling session on a managed application that calculates and displays a Mandelbrot set. When running Hotpath on the report it jumps me down the tree directly to the DrawMandel and SetPixel functions that are performing the bulk of the work for this scenario. The Hotpath will stop whenever it reaches a function with high exclusive values or when it hits two children with similar inclusive values. Also, it can be run from any point in the tree (just right click on the function) so you don’t have to always run it from the root function.
As you can see, the hotpath feature can save you a lot of time in performance analysis. Already folks who use the profiler internally here at Microsoft have become big fans of this feature. In fact, there has been spontaneous applause at meetings when we demoed the feature for the first time! As of right now it’s the closest that we have to a “show me my performance issue button.” And it’s one of the many ways that we are trying to help users to better understand and take action on their performance information in Visual Studio 2008.
Comments
Anonymous
September 14, 2007
Very cool!! As an addendum to this technology, would it be possible to exclude paths that delve into CLR classes. For example, if I'm building a windows form and I want to know why a certain tab is taking so long to load. I'm not interested in CLR classes; only the ones i have created (also not interested in the methods that my class might call that go into the CLR). Thanks.Anonymous
September 14, 2007
I wanted to do a little tour of some debugging and profiling features that you will see in Visual StudioAnonymous
September 14, 2007
I wanted to do a little tour of some debugging and profiling features that you will see in Visual StudioAnonymous
September 17, 2007
[ 原文地址 ] Debugging and Profiling Features in VS 2008 [ 原文 发表时间 ] Friday, September 14, 2007 6:48 PM 我希望介绍一些在Anonymous
September 17, 2007
The comment has been removedAnonymous
September 20, 2007
A bit earlier than normal, but it is time for another weekly roundup of news that focuses on .NET, agileAnonymous
October 09, 2007
I wanted to learn about the memory allocation profiling feature that is available VSTS 2008. While theAnonymous
October 19, 2007
I’ve recently been working on a series of post on my blog about many of the cool new features that weAnonymous
November 19, 2007
What else can I say? The big day has arrived (read the official word here on Soma's blog ) and we'reAnonymous
November 26, 2007
I'm currently trying to pro-actively drive the adoption of the .NET Framework 3.5 and VS 2008 withinAnonymous
January 26, 2008
The comment has been removedAnonymous
January 26, 2008
The comment has been removedAnonymous
March 09, 2008
Como muchos ya sabréis hace poco Microsoft lanzó al mercado Visual Studio 2008. Si estáis interesadosAnonymous
June 14, 2008
In Visual Studio 2008, we added the ability to quickly determine the most expensive call stack in yourAnonymous
February 05, 2009
[ Nacsa Sándor , 2009. január 19. – február 5.] Ez a Team System változat fejlett eszközrendszert kínál