Function Basic Extensions Class

DebugTimers

Turn one of the debug timers on or off.

Signature (Visual Basic / VBA)

Public Function DebugTimers( _
      Optional ByVal vTimerNum As Byte = 0 _
    , Optional ByVal vEnable As Boolean = True _
    ) As String

Code Example

    DebugTimersSample
    ASec: 1
    ASecH: 2
    ACsc: 3
    ACscH: 4
    Timer #0:  9.01 s.
    Timer #1:  2.86 s.  31.743%
    Timer #2:  1.97 s.  21.865%
    Timer #3:  2.36 s.  26.193%
    Timer #4:  1.6 s.  17.758%

Parameters

Parameter Description
vEnable True if the specified timer number should be turned on, and False if the timer should be turned off. vEnable defaults to True (the timer will be turned on) if it is missing.

Return Value

Function returns a String error message if vTimerNum is not between 0 and 16 inclusive. Function returns a String error message if an attempt is made to turn off a timer that is already off.

Notes & Version History

Summary This function has one overall timer and 16 subordinate timers. Timer #0 is the overall timer. It is usually enabled (turned-on) first and and disabled (turned-off) last. Normally, the overall timer will be used alone. When timer #0 is disabled, this function return a String that contains the elapsed time for timer #0 AND any of the other subordinate timers which were turned-on. Once timer #0 is on, the other timers numbered 1 through 16 can be enabled and disabled at will. If one or more subordinate timers are used, as in the example, then the function will also return the time elapsed as a percentage of the overall time elapsed (the duration of timer #0).
Note Since the resolution of the Timer is only 1/18 of a second, you should consider performing reasonably long tests.
vTimerNo The number of the timer to turn on or off. Must be between 0 (zero) and 16. vTimerNo defaults to 0 (zero) if it is missing.
v1.3 Change Changed the name of the argument to vTimerNum, changed its datatype from Variant to Byte, and specified a default value for it. Changed the name of the argument to vEnable, changed its datatype from Variant to Boolean, and specified a default value for it.