Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 263
  • Last Modified:

Code block execution timer

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
used2could
Asked:
used2could
  • 2
  • 2
1 Solution
 
jpaulinoCommented:
Hi used2could,

You can use a stopwatch

    Dim stopWatch As New Stopwatch  
    stopWatch.Start()

    ' your code

    stopWatch.Stop()
    Debug.WriteLine(stopWatch.ElapsedMilliseconds.ToString)
0
 
used2couldAuthor Commented:
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
 
jpaulinoCommented:
>> 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
 
used2couldAuthor Commented:
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now