VS2015 Debugging and Performance Features: PerfTips

Posted by

Visual Studio 2015 holds a couple of interesting features for the interested debugger and troubleshooter. This blog post will elaborate on some of the new tools and features in VS2015:

Perf Tips

You might already be familiar with the data tips that pop up when you hover over a variable during debugging:

image

Sidenote: Did you know that you can pin these debugging tips to the canvas by clicking the “pin”symbol? You can even use DEBUG –> EXPORT DATA TIPS to share them with a fellow developer and prove that the bug is his fault.

image

But back to the perf tips. Perf tips show up automatically during debugging and show you the time that has passed since the last debugger break. You can find them on the right hand side of the line that the debugger is currently breaking on. In the picture below, the debugger stopped on the LoadDevices() method and then proceeded to the yellow line. The perf tip indicates that the execution of LoadDevices() took 5411 milliseconds.

image

 

No more need for System.Diagnostics.Stopwatch all around your code!

When clicking the perftip link, visual studio will take you to the brand new diagnostic tools window that records every step the debugger took.

image

 

A couple of best practices related to perf tips can be found in this article by the visual studio team: http://blogs.msdn.com/b/visualstudioalm/archive/2014/08/18/perftips-performance-information-at-a-glance-while-debugging-with-visual-studio.aspx

They are:

Take multiple measurements: In order to exclude first-call performance degradation due to JIT, caching or loading, you should always take multiple measurements before relying on your numbers.

Verify in release: If you are investigating times below 50ms or anticipating a lot of work in performance optimizations, it is recommended to use Release mode and the tools in the Performance and Diagnostics hub for analysis. As perftips are used during debugging, the debugger itself could (minimally) skew the results.

If you don’t like this new feature, you can always turn perf tips off by going to TOOLS –> DEBUGGING –> “Show elapsed time PerfTip while debugging”.

image

If you like the feature but are not happy with the color of the text, you can even change the PerfTip color. Follow the instructions here:

http://dailydotnettips.com/2015/07/26/how-to-customize-perftips-color-in-visual-studio-2015/

Have fun perftipping!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.