UNPKG

947 BTypeScriptView Raw
1/** @module count */
2import { ICounterTimingCallback } from './ICounterTimingCallback';
3/**
4 * Callback object returned by {@link ICounters.beginTiming} to end timing
5 * of execution block and update the associated counter.
6 *
7 * ### Example ###
8 *
9 * let timing = counters.beginTiming("mymethod.exec_time");
10 * try {
11 * ...
12 * } finally {
13 * timing.endTiming();
14 * }
15 *
16 */
17export declare class CounterTiming {
18 private _start;
19 private _callback;
20 private _counter;
21 /**
22 * Creates a new instance of the timing callback object.
23 *
24 * @param counter an associated counter name
25 * @param callback a callback that shall be called when endTiming is called.
26 */
27 constructor(counter?: string, callback?: ICounterTimingCallback);
28 /**
29 * Ends timing of an execution block, calculates elapsed time
30 * and updates the associated counter.
31 */
32 endTiming(): void;
33}