By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,344 Members | 1,142 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,344 IT Pros & Developers. It's quick & easy.

Figureing out how long a sub takes to execute

P: n/a
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!
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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

"Brian Henry" wrote:
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!

Nov 21 '05 #2

P: n/a
"Brian Henry" <no****@nospam.com> schrieb:
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.


<URL:http://www.mentalis.org/soft/class.qpx?id=8>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.