In the past, I have used functions like GetTickCount to determine the amount of time a process takes. This has allowed me to benchmark the performance of my applications. Recently, however, I have started to use the built in Stopwatch object. This has proven to be more accurate and also gives me a measurement of time instead of some obscure number of system “clicks”. I have found a process that can take anywhere from 47 to 64 clicks, but always takes 60 milliseconds. Stopwatch is also fairly easy to use:

Dim sw as New Stopwatch()
sw.Start()

'Do some code process here

sw.Stop()
Msgbox("Process finished in " + sw.ElapsedMilliseconds.ToString() + " ms")

That’s it.