CounterTiming

Callback object returned by ICounters.beginTiming to end the counter_timing of an execution block and update the associated counter.

Description

The CounterTiming class allows you to create callback objects that are returned by ICounters.beginTiming to end the counter_timing of execution blocks and update the associated counters.

Constructors

Creates a new instance of the counter_timing callback object.

CounterTiming([String? counter, ICounterTimingCallback? callback])

  • counter: string - associated counter name
  • callback: ICounterTimingCallback? - callback that shall be called when end_timing is called.

Instance methods

endTiming

Ends the counter_timing of an execution block, calculates the elapsed time and updates the associated counter.

void endTiming()

Examples

var counter_timing = counters.beginTiming("mymethod.exec_time");
try {
    ...
} finally {
    counter_timing.endTiming();
}