Solved

Code block execution timer

Posted on 2008-06-23
4
256 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
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:…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

756 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