Home .NET ASP.NET profiler overview

ASP.NET profiler overview

by admin

Almost a year ago was published article about using the application profiler in Visual Studio 2010.It was suggested in the comments that it would be nice to compare this product with similar ones. I will try to make a brief review and comparison of the 4 most popular .NET profilers.
The review includes :

What do we expect from the profiler? We need absolute (time)and relative (percentages) statistics of execution of some code sections (if possible, with accuracy to the line). After optimization of some critical code sections we need to run profiling again and compare results.
Since my occupation is web development, the test subject will be an ASP.NET application ( download ):

    public partial class Default : System.Web.UI. Page

  1. {
  2. protected void Page_Load( object sender, EventArgs e)
  3. {
  4. SampleBadMethod1();
  5. SampleBadMethod2();
  6. }
  7. private void SampleBadMethod1()
  8. {
  9. for ( int i = 0; i < 100; i++)
  10. {
  11. SampleBadSubMethod1();
  12. }
  13. }
  14. private void SampleBadSubMethod1()
  15. {
  16. Thread.Sleep(10);
  17. }
  18. private void SampleBadMethod2()
  19. {
  20. for ( int i = 0; i < 10000; i++)
  21. {
  22. SampleBadSubMethod2();
  23. }
  24. }
  25. private void SampleBadSubMethod2()
  26. {
  27. Thread.Sleep(1);
  28. }
  29. }
  30. * This source code was highlighted with Source Code Highlighter

    A little lyrical digression. First I wanted to choose a real profiling application. I chose. Tailspin Spyworks which is used as a steb-by-step guide. It would seem that a beginner’s guide should be so polished as to immediately interest the developer, to teach some of the right stuff. And what did I see? A crooked layout, a mixture of business logic and markup, non-optimal queries to the database, select * even if 1-2 fields are stretched… It turned out very laborious to perform all optimizations 4 times (for 4 profilers), so I wrote the application I used in the tests in 3 minutes. If anyone is interested, future articles will be able to take Tailspin Spyworks apart.
    Enough lyrics, let’s run the profilers.

    Visual Studio Perfomance Profiler

    You launch it from VS through the menu Analyze -> Launch Perfomance Wizard.
    With a few easy steps we choose the type of profiling (I chose Instrumentation, because CPU sampling doesn’t show runtime, only percentages), the projects we want to study and whether we want to profile database queries through ADO.NET.
    After the Finish button is pressed, the browser starts, and the studio will have a splash screen with Pause and Stop buttons.
    ASP.NET profiler overview

    After the page finishes loading in the browser, we press Stop and get the result:
    ASP.NET profiler overview

    Let’s not dwell on the description of the profiler, it is quite well done here , here and here
    Here’s what the method statistics screen looks like :
    ASP.NET profiler overview

    Now we need to optimize critical parts of SampleBadMethod1 and SampleBadMethod2. As an "optimization" we reduce the number of iterations in the loop (for example, from 100 to 50 and from 10000 to 1000).
    We get the result again and compare it through the menu item Analyze-> Compare Perfomance Reports:
    ASP.NET profiler overview

    Well, well done, we have managed to speed up our application.
    Let’s repeat the same steps with the other profilers.

    ANTS Profiler

    When you create a new profiling session, the following window appears :
    ASP.NET profiler overview

    Here you can select the type of application, the profiling options and enter the application data, e.g. for ASP.NET application on dev-server this is the path to the application, the .net version, the port number, etc.
    After clicking Start Profiling the browser is started, while the ANTS Profiler is drawing the CPU usage on the time axis.
    Press Stop Profiling and get the result:
    ASP.NET profiler overview

    I won’t look in detail at the purpose and functions of the screen areas now (that’s a topic for a separate article), I will briefly say that in the upper part you see a timeline with the CPU load (or any other indicator that you can choose yourself), in the center the tree of methods with statistics on execution time and number of calls, in the lower part you see the source code of methods (if the code is available).
    There is some strangeness here: we see that the total execution time of method SampleBadSubMethod2 is 14 ms, though there is a 1 ms delay inside it and it is called 10000 times. Perhaps ANTS handles Thread.Sleep method incorrectly.
    Now, again, "optimize" the application, run the profiler, get the result and … can not compare using ANTS … In the FAQ on the site offer to run another profiler and switch between them, comparing the result. Well, thank you, what else can I say 🙂
    Into battle comes

    dotTrace

    When File-> Profile is selected, the window appears :
    ASP.NET profiler overview

    Select the type of application, set the settings and Run!
    After profiling starts a small window will appear where you can get the result (Get Snapshot) or end profiling.
    ASP.NET profiler overview

    After getting the result we see the following window :
    ASP.NET profiler overview

    Here you see a tree of methods with percentages and runtime. On the right side you can see the source of one or another method.
    Optimize application, get result and compare with original :
    ASP.NET profiler overview

    Well, the optimization has succeeded.
    And finally

    EQATEC Profiler

    Start the profiler and see the window :
    ASP.NET profiler overview

    Here you need to select the path to the application bin folder, select the builds you want to examine and click Build.
    ASP.NET profiler overview

    Then start your favorite browser and load the application page. If everything is OK, the log will show Profiled appication xxx started and the "Take snapshot" and "Reset counters" buttons will be active
    ASP.NET profiler overview

    Next, click "Take snapshot":
    ASP.NET profiler overview

    And here’s our snapshot:
    ASP.NET profiler overview

    We see the call statistics, as well as the representation of methods as blocks (in the lower part). These blocks are clickable, i.e. you can navigate down/up the call hierarchy.
    Now we optimize the application once again and compare the result :
    ASP.NET profiler overview

    We did it again, we sped up the application many times over.
    That’s all, let’s look at the summary table of capabilities of the presented profilers

    Summary

    VS Profiler ANTS dotTrace EQATEC
    Display of relative results of methods execution (in %) ASP.NET profiler overview ASP.NET profiler overview ASP.NET profiler overview ASP.NET profiler overview
    Showing absolute results of methods (in seconds, ms, etc.) ASP.NET profiler overview ASP.NET profiler overview ASP.NET profiler overview ASP.NET profiler overview
    Showing the number of method calls ASP.NET profiler overview ASP.NET profiler overview ASP.NET profiler overview ASP.NET profiler overview
    Viewing source methods ASP.NET profiler overview ASP.NET profiler overview ASP.NET profiler overview ASP.NET profiler overview
    Comparison of two measurements ASP.NET profiler overview ASP.NET profiler overview ASP.NET profiler overview ASP.NET profiler overview
    Price > 5000$ 1) from $395 2) from $ 199 3) free 4)

    1) as part of VS Premium and higher
    2) it depends on the edition
    3) free for open source projects
    4) limitation of 10 dlls loaded simultaneously, for $ with less restrictions
    Now let’s look at the advantages and disadvantages of each profiler I noticed separately, which are not listed in the comparison table.

    VS Profiler

    ASP.NET profiler overview
    embedded in VS (true, in premium and ultimate)
    ADO.NET interaction
    ASP.NET profiler overview
    Capricious, sometimes profiling won’t start without explanation
    ASP.NET profiler overview
    the appSettings section should be in web.config and not in a separate file, because some service settings are written there, and the developers apparently did not consider the location of this section in an external file
    ASP.NET profiler overview
    On a large project and not a very powerful machine it slows down noticeably

    ANTS Profiler

    ASP.NET profiler overview
    The most detailed information on method calls, lots of performance counters
    ASP.NET profiler overview
    in profile mode, SQL thinks that there are no other servers besides ./SQLEXPRESS 🙂
    ASP.NET profiler overview
    no comparison of the two measurement results

    dotTrace

    ASP.NET profiler overview
    liked the documentation the best
    ASP.NET profiler overview
    In tree view mode it’s a mess of numbers, method names, assemblies
    ASP.NET profiler overview
    Didn’t start in IIS Application mode, even though I did everything according to the good documentation.

    EQATEC

    ASP.NET profiler overview
    small and fast, good if you don’t want to see performance line by line and don’t need sources
    ASP.NET profiler overview
    this disadvantage is a consequence of the plus : fewer features than other competitors.
    So, I will make, perhaps, a subjective conclusion. My choice is EQATEC Profiler, for many performance evaluation tasks it is more than enough. If you have an opportunity to use VS Premium or Ultimate, the built-in profiler is quite a good product. In this case there will be no need to buy other profilers. Of the remaining two profilers amazing by its power ANTS profiler, although, of course, why there is no comparison of results – it is unclear. The dotTrace has an abundance of purchase options with a large number of features of the profiler itself.
    Thanks for finishing this review! I hope it helps you make your choice.
    P.S. Suggestions for a detailed review of each profiler are accepted.

    You may also like