Public Class Tester
Public Shared Sub Main
Dim lastMillis As Long
Dim numMillis As Long
Dim testWatch As New System.Diagnostics.Stopwatch
Dim endTime As Date
Dim results As String
endTime = Now.AddSeconds(1)
testWatch.Start()
Do
If (testWatch.ElapsedMilliseconds <> lastMillis) Then
numMillis += 1
lastMillis = testWatch.ElapsedMilliseconds
End If
Loop Until (Now > endTime)
results = "Elapsed milliseconds: " & _
testWatch.ElapsedMilliseconds.ToString & vbNewLine & _
"Number of updates per second: " & numMillis.ToString
Console.WriteLine(results)
End Sub
End Class
|