how to check speed


Wei-Shiun Chang
03-04-2007, 03:33 AM
I am new learning

now I am writing a code but wanna check how fast it is done

how do I check the time that my compute run the program?

thanks

ab1234
03-04-2007, 11:14 AM
by using the API functions routine .

ab1234
03-05-2007, 05:16 AM
hellow :
try with this vb.net :
First of all, add in heading of your class:

Imports System.Diagnostics

'Instanciation of a StopWatch object

Dim MyStopWatch As New Stopwatch

'Release of the “stop watch”

MyStopWatch.Start()

' ///////////////////////////////
“Place here the code which you want to evaluate, that can be for example “rough” code or” then the
' call of a method…
///////////////////////////////

'Stopping of the “stop watch”
MyStopWatch.Stop()

'Past time can be recovered very easily with a member of StopWatch,
'in the following way. The result is expressed in milliseconds
Dim timeExecution As Long
timeExecution = MyStopWatch.ElapsedMilliseconds


with vb6 :

Add this declaration to the beginning of your module:

Private Declare Function GetTickCount Lib "kernel32" () As Long

GetTickCount returns the number of milliseconds which ran out since the starting of the system. Call it at the beginning of your code, then at the end, and the difference between the two results will give you the number of milliseconds which ran out between the two calls.


Dim start As Long, endTime As Long
start = GetTickCount()
.....
'here the code to be timed
......
endTime = GetTickCount()
MsgBox "Time put in milliseconds: " & endtTime - start

ab1234
03-06-2007, 12:42 PM
hellow :
try with this vb.net :
First of all, add in heading of your class:

Imports System.Diagnostics

'Instanciation of a StopWatch object

Dim MyStopWatch As New Stopwatch

'Release of the “stop watch”

MyStopWatch.Start()

' ///////////////////////////////
“Place here the code which you want to evaluate, that can be for example “rough” code or” then the
' call of a method…
///////////////////////////////

'Stopping of the “stop watch”
MyStopWatch.Stop()

'Past time can be recovered very easily with a member of StopWatch,
'in the following way. The result is expressed in milliseconds
Dim timeExecution As Long
timeExecution = MyStopWatch.ElapsedMilliseconds


with vb6 :

Add this declaration to the beginning of your module:

Private Declare Function GetTickCount Lib "kernel32" () As Long

GetTickCount returns the number of milliseconds which ran out since the starting of the system. Call it at the beginning of your code, then at the end, and the difference between the two results will give you the number of milliseconds which ran out between the two calls.


Dim start As Long, endTime As Long
start = GetTickCount()
.....
'here the code to be timed
......
endTime = GetTickCount()
MsgBox "Time put in milliseconds: " & endTime - start
:) :) :) :) :) :) :) :)