1 |
|
2 | import { IReferenceable } from 'pip-services3-commons-node';
|
3 | import { IReferences } from 'pip-services3-commons-node';
|
4 | import { ICounters } from './ICounters';
|
5 | import { CounterTiming } from './CounterTiming';
|
6 | import { ICounterTimingCallback } from './ICounterTimingCallback';
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 | export declare class CompositeCounters implements ICounters, ICounterTimingCallback, IReferenceable {
|
41 | protected readonly _counters: ICounters[];
|
42 | |
43 |
|
44 |
|
45 |
|
46 |
|
47 | constructor(references?: IReferences);
|
48 | /**
|
49 | * Sets references to dependent components.
|
50 | *
|
51 | * @param references references to locate the component dependencies.
|
52 | */
|
53 | setReferences(references: IReferences): void;
|
54 | /**
|
55 | * Begins measurement of execution time interval.
|
56 | * It returns [[CounterTiming]] object which has to be called at
|
57 | * [[CounterTiming.endTiming]] to end the measurement and update the counter.
|
58 | *
|
59 | * @param name a counter name of Interval type.
|
60 | * @returns a [[CounterTiming]] callback object to end timing.
|
61 | */
|
62 | beginTiming(name: string): CounterTiming;
|
63 | /**
|
64 | * Ends measurement of execution elapsed time and updates specified counter.
|
65 | *
|
66 | * @param name a counter name
|
67 | * @param elapsed execution elapsed time in milliseconds to update the counter.
|
68 | *
|
69 | * @see [[CounterTiming.endTiming]]
|
70 | */
|
71 | endTiming(name: string, elapsed: number): void;
|
72 | /**
|
73 | * Calculates min/average/max statistics based on the current and previous values.
|
74 | *
|
75 | * @param name a counter name of Statistics type
|
76 | * @param value a value to update statistics
|
77 | */
|
78 | stats(name: string, value: number): void;
|
79 | /**
|
80 | * Records the last calculated measurement value.
|
81 | *
|
82 | * Usually this method is used by metrics calculated
|
83 | * externally.
|
84 | *
|
85 | * @param name a counter name of Last type.
|
86 | * @param value a last value to record.
|
87 | */
|
88 | last(name: string, value: number): void;
|
89 | /**
|
90 | * Records the current time as a timestamp.
|
91 | *
|
92 | * @param name a counter name of Timestamp type.
|
93 | */
|
94 | timestampNow(name: string): void;
|
95 | /**
|
96 | * Records the given timestamp.
|
97 | *
|
98 | * @param name a counter name of Timestamp type.
|
99 | * @param value a timestamp to record.
|
100 | */
|
101 | timestamp(name: string, value: Date): void;
|
102 | /**
|
103 | * Increments counter by 1.
|
104 | *
|
105 | * @param name a counter name of Increment type.
|
106 | */
|
107 | incrementOne(name: string): void;
|
108 | /**
|
109 | * Increments counter by given value.
|
110 | *
|
111 | * @param name a counter name of Increment type.
|
112 | * @param value a value to add to the counter.
|
113 | */
|
114 | increment(name: string, value: number): void;
|
115 | }
|