UNPKG

2.15 kBTypeScriptView Raw
1/** @module count */
2import { CounterTiming } from './CounterTiming';
3import { ICounters } from './ICounters';
4/**
5 * Dummy implementation of performance counters that doesn't do anything.
6 *
7 * It can be used in testing or in situations when counters is required
8 * but shall be disabled.
9 *
10 * @see [[ICounters]]
11 */
12export declare class NullCounters implements ICounters {
13 /**
14 * Creates a new instance of the counter.
15 */
16 constructor();
17 /**
18 * Begins measurement of execution time interval.
19 * It returns [[CounterTiming]] object which has to be called at
20 * [[CounterTiming.endTiming]] to end the measurement and update the counter.
21 *
22 * @param name a counter name of Interval type.
23 * @returns a [[CounterTiming]] callback object to end timing.
24 */
25 beginTiming(name: string): CounterTiming;
26 /**
27 * Calculates min/average/max statistics based on the current and previous values.
28 *
29 * @param name a counter name of Statistics type
30 * @param value a value to update statistics
31 */
32 stats(name: string, value: number): void;
33 /**
34 * Records the last calculated measurement value.
35 *
36 * Usually this method is used by metrics calculated
37 * externally.
38 *
39 * @param name a counter name of Last type.
40 * @param value a last value to record.
41 */
42 last(name: string, value: number): void;
43 /**
44 * Records the current time as a timestamp.
45 *
46 * @param name a counter name of Timestamp type.
47 */
48 timestampNow(name: string): void;
49 /**
50 * Records the given timestamp.
51 *
52 * @param name a counter name of Timestamp type.
53 * @param value a timestamp to record.
54 */
55 timestamp(name: string, value: Date): void;
56 /**
57 * Increments counter by 1.
58 *
59 * @param name a counter name of Increment type.
60 */
61 incrementOne(name: string): void;
62 /**
63 * Increments counter by given value.
64 *
65 * @param name a counter name of Increment type.
66 * @param value a value to add to the counter.
67 */
68 increment(name: string, value: number): void;
69}