State Inspection and Debugging - danielep71/VBA-PERFORMANCE_MANAGER GitHub Wiki
State Inspection and Debugging
This page explains how to inspect the internal state of cPerformanceManager during and after a timing session.
These members are especially useful when you want to:
- verify that a session started correctly
- confirm which timing backend is active
- inspect raw timestamps
- compare formatted and numeric elapsed results
- debug session-lifecycle problems
- inspect checkpoint/report state
Inspection surfaces
HasActiveSessionActiveMethodIDMethodName()T1T2ETRunLabelCheckpointCount
Quick meaning map
| Member | Type | Meaning |
|---|---|---|
HasActiveSession |
Boolean |
Whether StartTimer() has established an active session |
ActiveMethodID |
Integer |
The currently bound method ID |
MethodName(Idx) |
String |
Human-readable label for a method ID |
T1 |
Double |
Last raw start timestamp |
T2 |
Double |
Last raw end timestamp |
ET |
Double |
Last computed elapsed time in seconds |
RunLabel |
String |
Current session run label |
CheckpointCount |
Long |
Number of captured checkpoints in the current session |
Complete state-dump example
Option Explicit
Public Sub Example_StateDump()
Dim cPM As cPerformanceManager
Set cPM = New cPerformanceManager
Debug.Print "Initial state"
Debug.Print "HasActiveSession = "; cPM.HasActiveSession
Debug.Print "ActiveMethodID = "; cPM.ActiveMethodID
Debug.Print "MethodName = [" & cPM.MethodName(cPM.ActiveMethodID) & "]"
Debug.Print "T1 = "; cPM.T1
Debug.Print "T2 = "; cPM.T2
Debug.Print "ET = "; cPM.ET
Debug.Print "RunLabel = "; cPM.RunLabel
Debug.Print "CheckpointCount = "; cPM.CheckpointCount
cPM.StartTimer 5
cPM.SetRunLabel "Run A"
cPM.Pause 0.05, 1
cPM.Checkpoint "Phase 1"
Debug.Print "ElapsedSeconds = "; cPM.ElapsedSeconds
Debug.Print "After elapsed evaluation"
Debug.Print "HasActiveSession = "; cPM.HasActiveSession
Debug.Print "ActiveMethodID = "; cPM.ActiveMethodID
Debug.Print "MethodName = "; cPM.MethodName(cPM.ActiveMethodID)
Debug.Print "T1 = "; cPM.T1
Debug.Print "T2 = "; cPM.T2
Debug.Print "ET = "; cPM.ET
Debug.Print "RunLabel = "; cPM.RunLabel
Debug.Print "CheckpointCount = "; cPM.CheckpointCount
Debug.Print "ElapsedTime = "; cPM.ElapsedTime
cPM.ResetEnvironment
Set cPM = Nothing
End Sub