Solved

Code block execution timer

Posted on 2008-06-23
4
255 Views
Last Modified: 2013-11-26
Does any one know if there is a built in feature for Visual Studio 2005/2008 that will allow me to time how long a block of code takes to execute?
I hate writing temp code to manually track the execution time from say line: 5 to line: 65.

Thanks
~B
0
Comment
Question by:used2could
  • 2
  • 2
4 Comments
 
LVL 48

Accepted Solution

by:
jpaulino earned 500 total points
ID: 21850724
Hi used2could,

You can use a stopwatch

    Dim stopWatch As New Stopwatch  
    stopWatch.Start()

    ' your code

    stopWatch.Stop()
    Debug.WriteLine(stopWatch.ElapsedMilliseconds.ToString)
0
 

Author Comment

by:used2could
ID: 21850802
Hey ipaulino,
Thats kinda what i do now and i was hoping i could use two break points or something.

Thanks for the fast reply!
~B
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 21850839
>> Thats kinda what i do now and i was hoping i could use two break points or something.


Well I don't know another way to do it. I normally see this method from others to test code speed/execution time.

Perhaps exists but maybe a 3dr party control.
0
 

Author Comment

by:used2could
ID: 21850990
Ipaulino,
You're probably right about it not existing in VS 2005/2008 but i had my fingers crossed :( i'll leave this open for a little while to see if maybe someone has something different to say.

But you're answer is spot on so far.

~B
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Finding the IIS version 5 22
Vb.net threads keep increasing 2 36
Easy filter aspnet 2 27
Code works but breaks when I add one section 4 20
Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question