
I need to measure how long a code run, in seconds
Quote:
> I tryed to use API for a bette resolution but I got a runtime
> error with that LARGE_Integer
> Have a running code on this issue, please?
Use Long instead of Large_integer:
Public Declare Auto Function QueryPerformanceCounter _
Lib "kernel32.dll" (ByRef Counter As Long) As Integer
Public Declare Auto Function QueryPerformanceFrequency _
Lib "kernel32.dll" (ByRef counter As Long) As Integer
This is my class for encapsulation:
Public NotInheritable Class HPCounter
Private Shared m_Frequency As Long
Shared Sub New()
Win32.QueryPerformanceFrequency(m_Frequency)
End Sub
Private Sub New()
End Sub
Public Shared ReadOnly Property Counter() As Long
Get
Dim Result As Long
Win32.QueryPerformanceCounter(Result)
Return Result
End Get
End Property
Public Shared ReadOnly Property Frequency() As Long
Get
Return m_Frequency
End Get
End Property
Public Shared ReadOnly Property Seconds() As Double
Get
Return Counter / m_Frequency
End Get
End Property
End Class
Put the two API declarations into a class called Win32.
Armin