Callback object returned by ICounters.beginTiming to end the 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 timing of execution blocks and update the associated counters.
Constructors
Creates a new instance of the timing callback object.
public
CounterTiming(String counter, ICounterTimingCallback callback)
- counter: string - an associated counter name
- callback: ICounterTimingCallback - a callback that shall be called when end_timing is called.
Instance methods
endTiming
Ends timing of an execution block, calculates elapsed time and updates the associated counter.
public
void endTiming()
Examples
{@code
CounterTiming timing = counters.beginTiming("mymethod.exec_time");
try {
...
} finally {
timing.endTiming();
}
}