Performance Profiling of .NET Applications in Visual Studio 2013/2015
There have been a lot of improvements in the troubleshooting and especially profiling capabilities of Visual Studio over the last years.
While in VS2010 the Visual Studio Profiler was restricted to owners of the premium and ultimate versions, the Visual Studio team made a clever move in shifting the profiler down into the professional versions of VS2012. So profiling .NET applications by use of sampling and instrumentation became a tool for everybody. However, this act of kindness by Microsoft got mostly ignored by the community. Many developers still do not realize that they have a powerful tool in-the-box on their box!
Behold, it gets even better. With the release of Visual Studio 2013, the Performance & Diagnostics Hub was introduced. A central platform for everything you need related to application diagnostics and profiling.
The hub in VS2013 is under:
ANALYZE –> PERFORMANCE AND DIAGNOSTICS (Alt-F2)
or in VS2015:
ANALYZE –> START DIAGNOSTIC TOOLS WITHOUT DEBUGGING (Alt-F2)
Now that you know where it is, GO AND USE IT!!!
The idea of the hub is to unite several simple diagnostic tools. The current list in VS2013 Update 4 is:
- CPU Usage
- GPU Usage
- HTML UI Responsiveness(Store/Phone Apps Only)
- XAML UI Responsiveness (Store/Phone Apps Only)
- Memory Usage
- Performance Wizard (a.k.a Visual Studio Profiler)
- Energy Consumption (Store/Phone Apps Only)
As you can see, most of the new tools can only be used with store apps. However, Microsoft aims to expand the reach of the tools to other application types, such as WPF or ASP.NET. Updates are coming in quickly with VS updates.
Therefore, in Visual Studio 2015, the XAML UI Responsiveness Tool has been renamed and now fully supports Windows Presentation Foundation( WPF)!
On another note, the Performance & Diagnostics Hub is now available in all the VS editions, which includes the new VS Community Edition.
The tools in the hub mostly rely on Event Tracing for Windows (ETW). They record ETW events, collect data from other sources, correlate and create graphic reports for the developer to analyze.
Stay tuned for more posts on performance profiling in Visual Studio! In the meantime, grab the current edition of the Windows Developer magazine and read my article on the profiling tools: