You may use the System.Diagnostics.Stopwatch
class to time operations precisely in .NET.
Dim stopwatch As New Stopwatch()
stopwatch.Start()
'Perform timed operations here
stopwatch.Stop()
The elapsed TimeSpan
may now be retrieved as stopwatch.Elapsed
. For a direct analogue to your C code, you would write:
Dim elapsed = stopwatch.Elapsed.TotalSeconds
2
solved Calculating elapsed time [closed]