Solved

Code block execution timer

Posted on 2008-06-23
4
254 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
Comment Utility
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
Comment Utility
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
Comment Utility
>> 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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video discusses moving either the default database or any database to a new volume.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

728 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now