We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,277 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Calculate time to complete loop?

Hi,

I'm doing a software analysis assignemnt which requires me to deal with visual basic. I've never used the language before.

I have a loop which I would like to calucate the time taken to complete the loop.

Any heads up guys? I want something very simple.

3
Contributors
2
Replies
58 Minutes
Discussion Span
2 Months Ago
Last Updated
14
Views
sobias
Light Poster
33 posts since Oct 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

Ok, maybe this will help....I am guessing it is .net.

Dim stpWatchInfo As New System.Diagnostics.Stopwatch 'place this in the global decoration area

stpWatchInfo.Start()'place this in the loop beginning

'place the following right after the loop is done
dim tmr as long' just a variable to hold the amount of time it took
tmr = stpWatchInfo.Elapsed.TotalSeconds 'this is the number of seconds the loop took
tmr = stpWatchInfo.Elapsed.TotalMilliseconds 'this is the number of milliseconds the loop took

Keep in mind the stopwatch will slow down your loop by a small amount of time. This should give you a baseline of how long the loop is taking.

Larry

hometownnerd
Light Poster
37 posts since Sep 2007
Reputation Points: 21
Solved Threads: 4
Skill Endorsements: 2

like a var that will hold current time before entering the loop and a second one after the loop if finished, together with a datediff function?

adam_k
Veteran Poster
1,057 posts since Jun 2011
Reputation Points: 274
Solved Threads: 205
Skill Endorsements: 11

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0610 seconds using 2.67MB