It had been always a pain point for developers to find out execution time, performance issues for different code block. Most of the time we Get time of Code Execution Using StopWatch , or other logging mechanism, profiler tool etc. However, they are time consuming and sometime does not add values to check for a single methods, smaller code segments. Visual Studio 2015 makes our life easier. Getting the performance information is now in your finger tip and you can inspect this information during debugging itself.
PerTips is enabled by default. So when you start debugging your app, you should be able to view the time elapsed . Run the application in debug mode, and step through the lines by F10. You should be to see the time elapsed during the execution of previous statement. You can also consider the right side simple code block just to understand the time elapsed part. As shown in the below code block, LoadIntialData() has a 1000 ms thread sleep. The next statement shows, how many milliseconds has been elapsed for overall method call.
If you mouse hover on the time elapsed, a tool tip message would display which say the total time taken for the execution and that’s also includes the debugging overhead.
On click of the Time Elapsed option, Visual Studio will open the Diagnostic Tool Window, where you can deep down to the internal events to see the details of time.
You really don’t need have breakpoint or step through all the line, you can easily jumped into end of the method, and see the total elapsed time between two break points of between code blocks.
As shown in the above image, you can see total time elapsed for the LoadIntialData() is 1,269 ms. And this time tool tip message is something different, which says, the time elapsed since previous breakpoints. Visual Studio is smart enough to identify the step by step execution or block executionexcution and display results accordingly.
To get more inside of PerfTip, Please Read this post.