Quick start - danielep71/VBA-PERFORMANCE_MANAGER GitHub Wiki
Quick Start
This page gives you the first working timing example for cPerformanceManager.
First working example
Create a standard module and paste this code into it:
Option Explicit
Public Sub QuickStart_FirstTimingExample()
Dim cPM As cPerformanceManager
Dim ElapsedS As Double
Set cPM = New cPerformanceManager
cPM.StartTimer 5
Range("A1:A10000").Value = 1
ElapsedS = cPM.ElapsedSeconds
Debug.Print "Method : "; cPM.MethodName(cPM.ActiveMethodID)
Debug.Print "Elapsed (sec) : "; Format$(ElapsedS, "0.000000000")
Debug.Print "Elapsed (txt) : "; cPM.ElapsedTime
cPM.ResetEnvironment
Set cPM = Nothing
End Sub
What this example demonstrates
- method
5(QPC) is the recommended benchmark backend ElapsedSecondsis the main numeric timing surfaceElapsedTimeis the display/reporting companionResetEnvironmentis the explicit cleanup contract
Next steps
After the first example works, continue with: