Private Declare PtrSafe Function get_frequency Lib "kernel32" _
Alias "QueryPerformanceFrequency" ( _
ByRef Frequency As Currency) _
As Long
Private Declare PtrSafe Function get_time Lib "kernel32" _
Alias "QueryPerformanceCounter" ( _
ByRef Counter As Currency) _
As Long
然后在你的代码中你可以得到像这样的高精度时间测量...
' run this once
Dim per_second As Currency: get_frequency per_second
' ...
' get start time
Dim t0 As Currency: get_time t0
' HERE perform the operations you want to time
' ...
' get end time
Dim t1 As Currency: get_time t1
' calculate high precision duration
Dim elapsed_millis As Double: elapsed_millis = (t1 - t0) / per_second * 1000#
2条答案
按热度按时间hts6caw31#
在脚本的顶部,您可以添加以下内容:
然后在你的代码中你可以得到像这样的高精度时间测量...
6kkfgxo02#
在子例程的开头添加以下内容:
在子例程的末尾: