Loading

CHRONOSTART

debug

The CHRONOSTART function starts a stopwatch with the given name. To stop the stopwatch, call CHRONOEND. On top of recording the cumulative time between each start and end of the stopwatch, the number of calls of CHRONOSTART is recorded.

To recover the associated statistics, use CHRONOSTATS.

If calls of CHRONOSTART and CHRONOEND with the same name are nested, only the top level one is timed but each call to CHRONOSTART is counted. This allows the timing of recursive functions.

CHRONOSTART is available since version 2.1.0.

See also

Signatures

Examples

// Simple usage 'example' CHRONOSTART 40 2 + DROP 84 2 / DROP 'example' CHRONOEND CHRONOSTATS 'example' GET
// Safe usage of CHRONOEND with a TRY 'example' CHRONOSTART <% 40 2 + DROP 84 2 / DROP RETURN 'This won%27t be executed.' %> <% RETHROW %> <% 'example' CHRONOEND %> TRY CHRONOSTATS 'example' GET
// Nested calls 'example' CHRONOSTART 2 2 + DROP 'example' CHRONOSTART // Stopwatch already started but also increment call count 40 2 + DROP 84 2 / DROP 'example' CHRONOEND // Does not stop the example stopwatch 'example' CHRONOEND // Stops the example stopwatch CHRONOSTATS 'example' GET