Figureing out how long a sub takes to execute

B

Brian Henry

I want to time how long a specific sub takes to execute, what is the best
way to do this? this is only for one sub, and i just need a result back in
milliseconds or such to display to a user. thanks!
 
G

Guest

this will do the trick


Dim substart As DateTime = Now

'some code here

MsgBox("pause") 'just for testing


Dim elapsed_time As TimeSpan
Dim subEnd As DateTime = Now
elapsed_time = subEnd.Subtract(substart)

MsgBox(elapsed_time.TotalMilliseconds())

regards

Michel Posseth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top