Solved

Code block execution timer

Posted on 2008-06-23
4
257 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

Question has a verified solution.

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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

739 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