@oino-ts/types 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,15 +30,15 @@ export declare abstract class OINOBenchmark {
30
30
  * @param modules array of those benchmarks that are enabled
31
31
  */
32
32
  static setEnabled(modules: string[]): void;
33
- protected abstract _start(module: string, method: string): void;
33
+ protected abstract _startMetric(module: string, method: string): void;
34
34
  /**
35
35
  * Start benchmark timing.
36
36
  *
37
37
  * @param module of the benchmark
38
38
  * @param method of the benchmark
39
39
  */
40
- static start(module: string, method: string): void;
41
- protected abstract _end(module: string, method: string, category?: string): number;
40
+ static startMetric(module: string, method: string): void;
41
+ protected abstract _endMetric(module: string, method: string, category: string): void;
42
42
  /**
43
43
  * Complete benchmark timing
44
44
  *
@@ -46,8 +46,8 @@ export declare abstract class OINOBenchmark {
46
46
  * @param method of the benchmark
47
47
  * @param category optional subcategory of the benchmark
48
48
  */
49
- static end(module: string, method: string, category?: string): number;
50
- protected abstract _get(module: string, method: string): number;
49
+ static endMetric(module: string, method: string, category?: string): void;
50
+ protected abstract _getMetric(module: string, method: string): number;
51
51
  /**
52
52
  * Get given benchmark data.
53
53
  *
@@ -55,23 +55,53 @@ export declare abstract class OINOBenchmark {
55
55
  * @param method of the benchmark
56
56
  *
57
57
  */
58
- static get(module: string, method: string): number;
59
- protected abstract _getAll(): Record<string, number>;
58
+ static getMetric(module: string, method: string): number;
59
+ protected abstract _getMetrics(): Record<string, number>;
60
60
  /**
61
61
  * Get all benchmark data.
62
62
  *
63
63
  */
64
- static getAll(): Record<string, number>;
64
+ static getMetrics(): Record<string, number>;
65
+ protected abstract _trackMetric(module: string, method: string, category: string, value: number): void;
66
+ /**
67
+ * Track a metric value
68
+ *
69
+ * @param value of the metric
70
+ * @param module of the metric
71
+ * @param method of the metric
72
+ * @param category optional subcategory of the metric
73
+ *
74
+ */
75
+ static trackMetric(module: string, method: string, category: string, value: number): void;
76
+ protected abstract _trackException(module: string, method: string, category: string, name: string, message: string, stack: string): void;
77
+ /**
78
+ * Track an exception
79
+ *
80
+ * @param module of the benchmark
81
+ * @param method of the benchmark
82
+ * @param category optional subcategory of the benchmark
83
+ * @param name of the exception
84
+ * @param message of the exception
85
+ * @param stack trace of the exception
86
+ */
87
+ static trackException(module: string, method: string, category: string, name: string, message: string, stack: string): void;
88
+ protected abstract _getExceptions(): any[];
89
+ /**
90
+ * Get all tracked exceptions.
91
+ *
92
+ */
93
+ static getExceptions(): any[];
65
94
  }
66
95
  /**
67
96
  * OINOMemoryBenchmark is a memory-based benchmark implementation.
68
97
  * It stores the benchmark data in memory and allows to reset, start, end and get benchmark data.
69
- *
98
+ * In case of recursively/iteratively starting a benchmark, it will honor the first start and ignore the rest. *
70
99
  */
71
100
  export declare class OINOMemoryBenchmark extends OINOBenchmark {
72
- private _benchmarkCount;
73
- private _benchmarkData;
74
- private _benchmarkStart;
101
+ protected _benchmarkCount: Record<string, number>;
102
+ protected _benchmarkData: Record<string, number>;
103
+ protected _benchmarkStart: Record<string, number>;
104
+ protected _exceptions: any[];
75
105
  /**
76
106
  * Reset benchmark data (but not what is enabled).
77
107
  *
@@ -83,7 +113,7 @@ export declare class OINOMemoryBenchmark extends OINOBenchmark {
83
113
  * @param module of the benchmark
84
114
  * @param method of the benchmark
85
115
  */
86
- protected _start(module: string, method: string): void;
116
+ protected _startMetric(module: string, method: string): void;
87
117
  /**
88
118
  * Complete benchmark timing
89
119
  *
@@ -91,7 +121,7 @@ export declare class OINOMemoryBenchmark extends OINOBenchmark {
91
121
  * @param method of the benchmark
92
122
  * @param category optional subcategory of the benchmark
93
123
  */
94
- protected _end(module: string, method: string, category?: string): number;
124
+ protected _endMetric(module: string, method: string, category: string): void;
95
125
  /**
96
126
  * Get given benchmark data.
97
127
  *
@@ -99,10 +129,13 @@ export declare class OINOMemoryBenchmark extends OINOBenchmark {
99
129
  * @param method of the benchmark
100
130
  *
101
131
  */
102
- protected _get(module: string, method: string): number;
132
+ protected _getMetric(module: string, method: string): number;
103
133
  /**
104
134
  * Get all benchmark data.
105
135
  *
106
136
  */
107
- protected _getAll(): Record<string, number>;
137
+ protected _getMetrics(): Record<string, number>;
138
+ protected _trackMetric(module: string, method: string, category: string, value: number): void;
139
+ protected _trackException(module: string, method: string, category: string, name: string, message: string, stack: string): void;
140
+ protected _getExceptions(): any[];
108
141
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oino-ts/types",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "OINO TS package for types.",
5
5
  "author": "Matias Kiviniemi (pragmatta)",
6
6
  "license": "MPL-2.0",