The performance of the application is of utmost importance and this going to be very important from the perspective of client which they are facing if you have performance leaks in your application. To identify the performance leak prior to the Production environment is not an easy task but the new emerging power of VS 2015 Diagnostic Tools windows made it easier for us to have a deep performance analysis before it go live.
Instead of running a full profiling tool, you might take one or more of the following steps.
Insert code into an app (such as System.Diagnostics.Stopwatch) to measure how long it takes to run between various points, iteratively adding stopwatches as needed to narrow down the hot path.
Step through the code to see if any particular step “feels slow.”
These practices are typically not accurate, not a good use of time or both. That’s why there are now performance tools in the debugger. They will help you understand your apps performance during normal debugging.
Why not try this new and improved way to diagnose.
Diagnostic Tools Window
The primary difference you’ll notice when debugging code in Visual Studio 2015 is the new Diagnostic Tools window that will appear, firstly go to Debug and Click on Menu Item Show Diagnostic Tools, as in the following Figure 1.
Figure 1: How to open Diagnostic tools Window in Visual Studio 2015
These Diagnostic Tools present information in two complementary ways. They add graphs to the timeline in the upper-half of the window, and provide detailed information in the tabs on the bottom as in the following Figure 2.
Figure 2: the New Diagnostic Tools Window in Visual Studio 2015
- Debugger Events (with IntelliTrace) gives you access to all Break, Output, and IntelliTrace events collected during your debugging session. The data is presented both as a timeline and as a tabular view. The two views are synchronized and can interact with each other.
- The Memory Usage tool allows you to monitor the memory usage of your app while you are debugging. You can also take and compare detailed snapshots of native and managed memory to analyze the cause of memory growth and memory leaks.
- The CPU Usage tool allows you to monitor the CPU usage of your application while you are debugging.
New IntelliTrace UI and experience:
- Record specific events.
- Examine related code, data that appears in the Locals window during debugger events, and function call information.
- Debug errors that are hard to reproduce or that happen in deployment.
Why debug with IntelliTrace
- An exception happens.
Figure 3: PerfTips
There is also a new option to show the CPU consumption time with PerfTips by clicking on that checkbox.
In Visual Studio 2015, you’ll see three tools in the Diagnostics Tools window: Debugger (includes IntelliTrace), Memory Usage and CPU Usage.
You can enable or disable the CPU Usage and Memory Usage tools by clicking on the Select Tools dropdown as in the following image:
The Debugger tool has three tracks that show Break Events, Output Events and IntelliTrace Events.
Figure 4: Digonostic Tools
This feature is used to trace the root cause of Bug/Error fastly and reliably by using events like clicking, post click changes and lots of trace information. This rich tool has lot of information about your running events.
You can spend less time debugging your application when you use IntelliTrace to record and trace your code’s execution history. You can find bugs easily because IntelliTrace lets you.
Note: You can use IntelliTrace in Visual Studio Enterprise edition (but not the Professional or Community editions).
IntelliTrace enhances the debugging experience and saves you valuable debugging time! It does that by capturing additional events with useful information about your programs execution, allowing you to identify potential root causes with fewer debugging iterations. The data it collects appear as events in the IntelliTrace track and in the table in the Events details tab.
In the Enterprise edition of Visual Studio 2015, you will see that we have completely revamped the user interface of IntelliTrace by bringing it into the Diagnostic Tools window. IntelliTrace vastly enhances the debugger by automatically capturing interesting events in your application and surfacing them in the Events graph and the Events tab as in the following image:
Figure 5: Event
UIcon in the graph area of events are the interesting events that are captured while debugging.
By mouse hovering it give detail information in the tooltip and by double clicking to the event it points to the event in Events Tab.
Traditional or live debugging shows only your application’s current state, with limited data about past events. You either have to infer these events based on the applications current state, or you have to recreate these events by rerunning your application.
IntelliTrace expands this traditional debugging experience by recording specific events and data at these points of time. This lets you see what happened in your application without restarting it, especially if you step past where the bug is. IntelliTrace is turned on by default during traditional debugging and collects data automatically and invisibly. This lets you switch easily between traditional debugging and IntelliTrace debugging to see the recorded information. See IntelliTrace Features and what data does IntelliTrace collect?
IntelliTrace can also help you debug errors that are hard to reproduce or that happen in deployment. You can collect IntelliTrace data and save it to an IntelliTrace log file (.iTrace file). An .iTrace file contains details about exceptions, performance events, web requests, test data, threads, modules, and other system information. You can open this file in Visual Studio Enterprise, select an item, and start debugging with IntelliTrace. This lets you go to any event in the file and see specific details about your application at that point in time.
These events made easier to capture where the bug happens as it give full stack tracing in historical debugging section as in the following:
Without IntelliTrace, you get a message about an exception but you don’t have much information about the events that led to the exception. You can examine the call stack to see the chain of calls that led to the exception, but you can’t see the sequence of events that happened during those calls. With IntelliTrace, you can examine the events that happened before the exception.
PerfTips (performance information in tooltips) is a new feature introduced in Visual Studio 2015 through which you can calculate time between the breakpoint hit points to the last point or while you step into the code.
It give you tips while you debug through code of the elapsed time as in the following image and on hovering over the mouse it gives detailed analysis and the value it estimate also contain debug overhead.
By clicking the elapsed time it can open the diagnostic tools window and show the current event with process memory and CPU utilization if selected.
Beside the elapsed time information if you want to show the CPU utilization this can be set through right clicking the elapsed time link.
When we right-click on that time it’ll show the PerfTips options to configure that.
The default value of showing elapsed time are in milliseconds.
Figure 6: Performance Tools