如何得知一个函数的精确的运行时间

解决方案 »

  1.   

    function a()
    t=now
    ....
    debug.print Second(Now - t)
    end function
      

  2.   

    这个方法估计是最精确的了
    如果有再精确的方法请告诉我
    Private Declare Function GetTickCount Lib "kernel32" () As Long
    Public Sub SetStart()
        lStartTime = GetTickCount()
    End Sub
    Public Sub SetEnd()    Dim lTimeSpan As Long
         
        lEndTime = GetTickCount()
        lTimeSpan = lEndTime - lStartTime
        Label6.Caption = CStr(lTimeSpan \ 1000) & "." & CStr(lTimeSpan Mod 1000) & "秒"
        
    End Sub