dotTrace Performance lets you profile different kinds of .NET applications, including applications based on .NET Framework up to version 4.5, Silverlight 4 and 5, and even Windows Store applications. It offers a convenient way to uncover potential performance issues in your applications and find bottlenecks in your code.
There are two ways to start profiling your application: you can either launch dotTrace Performance as a standalone tool or from Visual Studio. At the time of this writing, dotTrace Performance integrates into four versions of Visual Studio: 2005, 2008, 2010, and 2012.
Standalone. This mode is ideal for applications where the original project or source code is not available or when you want to run dotTrace Performance without having Visual Studio installed or launched.
- Start dotTrace Performance from the Windows Start menu.
- Click Profile on the Home tab.
From Visual Studio. This mode is ideal when you want to profile an existing project running under Visual Studio.
- Start Visual Studio
- Open a solution.
- On the menu bar, choose dotTrace | Profile Startup Project for the startup project opened in Visual Studio, or dotTrace | Profile Application to attach to a running .NET application.
Next step is to select the type of the application you are going to profile. Note that dotTrace Performance Professional Edition allows you to profile more application types than Standard Edition. In this example we'll profile a web application hosted in IIS Express.
The Profiler Configuration dialog box that opens up lets you fine-tune your profiling experience. Depending on the selected application type, different sets of profiling options can be displayed.
One of the important settings that affect profiling speed and accuracy is Profiling Type which gives you three options:
- Sampling profiling is the fastest and the least precise method. It allows you to quickly get a general idea of the application's performance.
- Tracing profiling is slower, but more precise than Sampling. In this mode you can learn precise timing information and the number of calls on the method level.
- Line-by-line profiling is the slowest, but the most accurate method. It lets you collect the most detailed information on methods that perform significant algorithmic work.
You can also choose the Time Measurement method to specify the granularity and accuracy of time measurement.
Click Run to start profiling. dotTrace Performance will attach to your application's process and start collecting performance data. The Controller window is also displayed.
Once you feel that all information you need has been collected, click Get Snapshot. This will capture the data and display it in a snapshot window.
Snapshots can be stored and compared, so you can see how code changes affected your application performance.
dotTrace Performance offers you multiple views for analyzing snapshot information. The Threads Tree view shown by default allows you to drill down in the snapshot information based on the threads in your application.
The Call Tree view organizes data based on method calls, Plain List shows all the different methods that have been called, what other methods they have called, how long these calls took and so on.
The Hot Spots view shows methods that have the highest own time in your application. In other words: methods that dotTrace Performance identified as a potential performance issue.
Note that whenever you select a method, dotTrace Performance shows you the actual code for this method based on information provided by your application's debugging symbols. If no source code is available, dotTrace Performance will try to decompile the method from the assembly.
Once you've mastered these basics, learn the various techniques in analyzing profiler data. dotTrace Performance includes great features like remote profiling, navigating through method calls, filtering and folding and estimating performance gains. All of them are described on the dotTrace documentation page.
Finally, don't forget to check out JetBrains TV and JetBrains .NET Tools blog for more tips and tricks with dotTrace profilers. You might also like JetBrains on Facebook or follow dotTrace on twitter.