@itwin/ecschema-metadata 5.2.0-dev.17 → 5.2.0-dev.18
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.
- package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.d.ts +18 -24
- package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.d.ts.map +1 -1
- package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.js +40 -20
- package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.js.map +1 -1
- package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.d.ts +2 -2
- package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.d.ts.map +1 -1
- package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.js +5 -4
- package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.js.map +1 -1
- package/lib/cjs/IncrementalLoading/IncrementalSchemaReader.d.ts.map +1 -1
- package/lib/cjs/IncrementalLoading/IncrementalSchemaReader.js +1 -0
- package/lib/cjs/IncrementalLoading/IncrementalSchemaReader.js.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaParser.d.ts +8 -2
- package/lib/cjs/IncrementalLoading/SchemaParser.d.ts.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaParser.js +6 -6
- package/lib/cjs/IncrementalLoading/SchemaParser.js.map +1 -1
- package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.d.ts +18 -24
- package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.d.ts.map +1 -1
- package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.js +39 -19
- package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.js.map +1 -1
- package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.d.ts +2 -2
- package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.d.ts.map +1 -1
- package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.js +5 -4
- package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.js.map +1 -1
- package/lib/esm/IncrementalLoading/IncrementalSchemaReader.d.ts.map +1 -1
- package/lib/esm/IncrementalLoading/IncrementalSchemaReader.js +1 -0
- package/lib/esm/IncrementalLoading/IncrementalSchemaReader.js.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaParser.d.ts +8 -2
- package/lib/esm/IncrementalLoading/SchemaParser.d.ts.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaParser.js +6 -6
- package/lib/esm/IncrementalLoading/SchemaParser.js.map +1 -1
- package/package.json +6 -6
- package/lib/cjs/IncrementalLoading/PerformanceLogger.d.ts +0 -60
- package/lib/cjs/IncrementalLoading/PerformanceLogger.d.ts.map +0 -1
- package/lib/cjs/IncrementalLoading/PerformanceLogger.js +0 -82
- package/lib/cjs/IncrementalLoading/PerformanceLogger.js.map +0 -1
- package/lib/esm/IncrementalLoading/PerformanceLogger.d.ts +0 -60
- package/lib/esm/IncrementalLoading/PerformanceLogger.d.ts.map +0 -1
- package/lib/esm/IncrementalLoading/PerformanceLogger.js +0 -78
- package/lib/esm/IncrementalLoading/PerformanceLogger.js.map +0 -1
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.PerformanceLogger = void 0;
|
|
8
|
-
/**
|
|
9
|
-
* Utility class used to log query load times for Schema and
|
|
10
|
-
* SchemaItem queries.
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
13
|
-
class PerformanceLogger {
|
|
14
|
-
_iModelItems = new Map();
|
|
15
|
-
_label;
|
|
16
|
-
// flag that controls if logging is enabled.
|
|
17
|
-
disableLogging = false;
|
|
18
|
-
/**
|
|
19
|
-
* Initializes a new PerformanceLogger instance.
|
|
20
|
-
* @param label Arbitrary label used to tag this logging session (ex. IModel name)
|
|
21
|
-
*/
|
|
22
|
-
constructor(label) {
|
|
23
|
-
this._label = label || "";
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Gets the Map of logged Schema entries. The Map key is the iModel name. The Map
|
|
27
|
-
* value is a second Map whose key is a Schema name and value is a SchemaLoadData
|
|
28
|
-
* object.
|
|
29
|
-
*/
|
|
30
|
-
get logItems() {
|
|
31
|
-
return this._iModelItems;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Adds a new log entry to the Schema Map.
|
|
35
|
-
* @param startTime The start time of the entry to be logged (end time/duration is handled in this method).
|
|
36
|
-
* @param schemaName The Schema being queried.
|
|
37
|
-
*/
|
|
38
|
-
logSchema(startTime, schemaName) {
|
|
39
|
-
if (this.disableLogging)
|
|
40
|
-
return;
|
|
41
|
-
const loadTime = new Date().getTime() - startTime;
|
|
42
|
-
const schemaMap = this.getSchemaMap(this._label);
|
|
43
|
-
const schemaLoadData = this.getSchemaLoadData(schemaMap, schemaName);
|
|
44
|
-
schemaLoadData.loadTime = loadTime;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Adds a new log entry to the SchemaItem Map.
|
|
48
|
-
* @param startTime The start time of the entry to be logged (end time/duration is handled in this method).
|
|
49
|
-
* @param schemaName The name of the Schema being queried.
|
|
50
|
-
* @param schemaItemType The SchemaItemType name of the type being queried.
|
|
51
|
-
* @param itemCount The number of items retrieved in the query.
|
|
52
|
-
*/
|
|
53
|
-
logSchemaItem(startTime, schemaName, schemaItemType, itemCount) {
|
|
54
|
-
if (this.disableLogging)
|
|
55
|
-
return;
|
|
56
|
-
const loadTime = new Date().getTime() - startTime;
|
|
57
|
-
const schemaMap = this.getSchemaMap(this._label);
|
|
58
|
-
const schemaLoadData = this.getSchemaLoadData(schemaMap, schemaName);
|
|
59
|
-
if (schemaLoadData.schemaItemMap.has(schemaItemType))
|
|
60
|
-
throw new Error("There should not be a multiple load times for a given iModel, Schema, SchemaItemType combination.");
|
|
61
|
-
schemaLoadData.schemaItemMap.set(schemaItemType, { loadTime, itemCount });
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Clears all log entries from the Map.
|
|
65
|
-
*/
|
|
66
|
-
clearLogs() {
|
|
67
|
-
this._iModelItems.clear();
|
|
68
|
-
}
|
|
69
|
-
getSchemaMap(iModel) {
|
|
70
|
-
if (!this._iModelItems.has(iModel)) {
|
|
71
|
-
this._iModelItems.set(iModel, new Map());
|
|
72
|
-
}
|
|
73
|
-
return this._iModelItems.get(iModel);
|
|
74
|
-
}
|
|
75
|
-
getSchemaLoadData(schemaMap, schemaName) {
|
|
76
|
-
if (!schemaMap.has(schemaName))
|
|
77
|
-
schemaMap.set(schemaName, { schemaItemMap: new Map() });
|
|
78
|
-
return schemaMap.get(schemaName);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
exports.PerformanceLogger = PerformanceLogger;
|
|
82
|
-
//# sourceMappingURL=PerformanceLogger.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PerformanceLogger.js","sourceRoot":"","sources":["../../../src/IncrementalLoading/PerformanceLogger.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAsBhG;;;;GAIG;AACH,MAAa,iBAAiB;IACpB,YAAY,GAA6C,IAAI,GAAG,EAAE,CAAC;IACnE,MAAM,CAAS;IAEvB,4CAA4C;IACrC,cAAc,GAAG,KAAK,CAAC;IAE9B;;;OAGG;IACH,YAAY,KAAc;QACxB,IAAI,CAAC,MAAM,GAAG,KAAK,IAAI,EAAE,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACI,SAAS,CAAC,SAAiB,EAAE,UAAkB;QACpD,IAAI,IAAI,CAAC,cAAc;YACrB,OAAO;QAET,MAAM,QA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AAiB,CAAC,SAAsC,EAAE,UAAkB;QAClF,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC;YAC5B,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,EAAE,aAAa,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC,CAAA;QAEzD,OAAO,SAAS,CAAC,GAAG,CAAC,UAAU,CAAmB,CAAC;IACrD,CAAC;CACF;AApFD,8CAoFC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * Contains the properties needed to track load times\n * for SchemaItem queries.\n * @internal\n */\nexport interface SchemaItemLoadData {\n loadTime: number,\n itemCount: number\n}\n\n/**\n * Contains the properties needed to track load times\n * for Schema queries.\n * @internal\n */\nexport interface SchemaLoadData {\n loadTime?: number,\n schemaItemMap: Map<string, SchemaItemLoadData>;\n}\n\n/**\n * Utility class used to log query load times for Schema and\n * SchemaItem queries.\n * @internal\n */\nexport class PerformanceLogger {\n private _iModelItems: Map<string, Map<string, SchemaLoadData>> = new Map();\n private _label: string;\n\n // flag that controls if logging is enabled.\n public disableLogging = false;\n\n /**\n * Initializes a new PerformanceLogger instance.\n * @param label Arbitrary label used to tag this logging session (ex. IModel name)\n */\n constructor(label?: string) {\n this._label = label || \"\";\n }\n\n /**\n * Gets the Map of logged Schema entries. The Map key is the iModel name. The Map\n * value is a second Map whose key is a Schema name and value is a SchemaLoadData\n * object.\n */\n public get logItems(): Map<string, Map<string, SchemaLoadData>> {\n return this._iModelItems;\n }\n\n /**\n * Adds a new log entry to the Schema Map.\n * @param startTime The start time of the entry to be logged (end time/duration is handled in this method).\n * @param schemaName The Schema being queried.\n */\n public logSchema(startTime: number, schemaName: string) {\n if (this.disableLogging)\n return;\n\n const loadTime = new Date().getTime() - startTime;\n\n const schemaMap = this.getSchemaMap(this._label);\n const schemaLoadData = this.getSchemaLoadData(schemaMap, schemaName);\n\n schemaLoadData.loadTime = loadTime;\n }\n\n /**\n * Adds a new log entry to the SchemaItem Map.\n * @param startTime The start time of the entry to be logged (end time/duration is handled in this method).\n * @param schemaName The name of the Schema being queried.\n * @param schemaItemType The SchemaItemType name of the type being queried.\n * @param itemCount The number of items retrieved in the query.\n */\n public logSchemaItem(startTime: number, schemaName: string, schemaItemType: string, itemCount: number) {\n if (this.disableLogging)\n return;\n\n const loadTime = new Date().getTime() - startTime;\n\n const schemaMap = this.getSchemaMap(this._label);\n const schemaLoadData = this.getSchemaLoadData(schemaMap, schemaName);\n\n if (schemaLoadData.schemaItemMap.has(schemaItemType))\n throw new Error(\"There should not be a multiple load times for a given iModel, Schema, SchemaItemType combination.\");\n\n schemaLoadData.schemaItemMap.set(schemaItemType, { loadTime, itemCount });\n }\n\n /**\n * Clears all log entries from the Map.\n */\n public clearLogs() {\n this._iModelItems.clear();\n }\n\n private getSchemaMap(iModel: string): Map<string, SchemaLoadData> {\n if (!this._iModelItems.has(iModel)) {\n this._iModelItems.set(iModel, new Map());\n }\n\n return this._iModelItems.get(iModel) as Map<string, SchemaLoadData>;\n }\n\n private getSchemaLoadData(schemaMap: Map<string, SchemaLoadData>, schemaName: string): SchemaLoadData {\n if (!schemaMap.has(schemaName))\n schemaMap.set(schemaName, { schemaItemMap: new Map() })\n\n return schemaMap.get(schemaName) as SchemaLoadData;\n }\n}"]}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Contains the properties needed to track load times
|
|
3
|
-
* for SchemaItem queries.
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
export interface SchemaItemLoadData {
|
|
7
|
-
loadTime: number;
|
|
8
|
-
itemCount: number;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Contains the properties needed to track load times
|
|
12
|
-
* for Schema queries.
|
|
13
|
-
* @internal
|
|
14
|
-
*/
|
|
15
|
-
export interface SchemaLoadData {
|
|
16
|
-
loadTime?: number;
|
|
17
|
-
schemaItemMap: Map<string, SchemaItemLoadData>;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Utility class used to log query load times for Schema and
|
|
21
|
-
* SchemaItem queries.
|
|
22
|
-
* @internal
|
|
23
|
-
*/
|
|
24
|
-
export declare class PerformanceLogger {
|
|
25
|
-
private _iModelItems;
|
|
26
|
-
private _label;
|
|
27
|
-
disableLogging: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Initializes a new PerformanceLogger instance.
|
|
30
|
-
* @param label Arbitrary label used to tag this logging session (ex. IModel name)
|
|
31
|
-
*/
|
|
32
|
-
constructor(label?: string);
|
|
33
|
-
/**
|
|
34
|
-
* Gets the Map of logged Schema entries. The Map key is the iModel name. The Map
|
|
35
|
-
* value is a second Map whose key is a Schema name and value is a SchemaLoadData
|
|
36
|
-
* object.
|
|
37
|
-
*/
|
|
38
|
-
get logItems(): Map<string, Map<string, SchemaLoadData>>;
|
|
39
|
-
/**
|
|
40
|
-
* Adds a new log entry to the Schema Map.
|
|
41
|
-
* @param startTime The start time of the entry to be logged (end time/duration is handled in this method).
|
|
42
|
-
* @param schemaName The Schema being queried.
|
|
43
|
-
*/
|
|
44
|
-
logSchema(startTime: number, schemaName: string): void;
|
|
45
|
-
/**
|
|
46
|
-
* Adds a new log entry to the SchemaItem Map.
|
|
47
|
-
* @param startTime The start time of the entry to be logged (end time/duration is handled in this method).
|
|
48
|
-
* @param schemaName The name of the Schema being queried.
|
|
49
|
-
* @param schemaItemType The SchemaItemType name of the type being queried.
|
|
50
|
-
* @param itemCount The number of items retrieved in the query.
|
|
51
|
-
*/
|
|
52
|
-
logSchemaItem(startTime: number, schemaName: string, schemaItemType: string, itemCount: number): void;
|
|
53
|
-
/**
|
|
54
|
-
* Clears all log entries from the Map.
|
|
55
|
-
*/
|
|
56
|
-
clearLogs(): void;
|
|
57
|
-
private getSchemaMap;
|
|
58
|
-
private getSchemaLoadData;
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=PerformanceLogger.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PerformanceLogger.d.ts","sourceRoot":"","sources":["../../../src/IncrementalLoading/PerformanceLogger.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;CAChD;AAED;;;;GAIG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,YAAY,CAAuD;IAC3E,OAAO,CAAC,MAAM,CAAS;IAGhB,cAAc,UAAS;IAE9B;;;OAGG;gBACS,KAAK,CAAC,EAAE,MAAM;IAI1B;;;;OAIG;IACH,IAAW,QAAQ,IAAI,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAE9D;IAED;;;;OAIG;IACI,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAYtD;;;;;;OAMG;IACI,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAerG;;OAEG;IACI,SAAS;IAIhB,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,iBAAiB;CAM1B"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
/**
|
|
6
|
-
* Utility class used to log query load times for Schema and
|
|
7
|
-
* SchemaItem queries.
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
export class PerformanceLogger {
|
|
11
|
-
_iModelItems = new Map();
|
|
12
|
-
_label;
|
|
13
|
-
// flag that controls if logging is enabled.
|
|
14
|
-
disableLogging = false;
|
|
15
|
-
/**
|
|
16
|
-
* Initializes a new PerformanceLogger instance.
|
|
17
|
-
* @param label Arbitrary label used to tag this logging session (ex. IModel name)
|
|
18
|
-
*/
|
|
19
|
-
constructor(label) {
|
|
20
|
-
this._label = label || "";
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Gets the Map of logged Schema entries. The Map key is the iModel name. The Map
|
|
24
|
-
* value is a second Map whose key is a Schema name and value is a SchemaLoadData
|
|
25
|
-
* object.
|
|
26
|
-
*/
|
|
27
|
-
get logItems() {
|
|
28
|
-
return this._iModelItems;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Adds a new log entry to the Schema Map.
|
|
32
|
-
* @param startTime The start time of the entry to be logged (end time/duration is handled in this method).
|
|
33
|
-
* @param schemaName The Schema being queried.
|
|
34
|
-
*/
|
|
35
|
-
logSchema(startTime, schemaName) {
|
|
36
|
-
if (this.disableLogging)
|
|
37
|
-
return;
|
|
38
|
-
const loadTime = new Date().getTime() - startTime;
|
|
39
|
-
const schemaMap = this.getSchemaMap(this._label);
|
|
40
|
-
const schemaLoadData = this.getSchemaLoadData(schemaMap, schemaName);
|
|
41
|
-
schemaLoadData.loadTime = loadTime;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Adds a new log entry to the SchemaItem Map.
|
|
45
|
-
* @param startTime The start time of the entry to be logged (end time/duration is handled in this method).
|
|
46
|
-
* @param schemaName The name of the Schema being queried.
|
|
47
|
-
* @param schemaItemType The SchemaItemType name of the type being queried.
|
|
48
|
-
* @param itemCount The number of items retrieved in the query.
|
|
49
|
-
*/
|
|
50
|
-
logSchemaItem(startTime, schemaName, schemaItemType, itemCount) {
|
|
51
|
-
if (this.disableLogging)
|
|
52
|
-
return;
|
|
53
|
-
const loadTime = new Date().getTime() - startTime;
|
|
54
|
-
const schemaMap = this.getSchemaMap(this._label);
|
|
55
|
-
const schemaLoadData = this.getSchemaLoadData(schemaMap, schemaName);
|
|
56
|
-
if (schemaLoadData.schemaItemMap.has(schemaItemType))
|
|
57
|
-
throw new Error("There should not be a multiple load times for a given iModel, Schema, SchemaItemType combination.");
|
|
58
|
-
schemaLoadData.schemaItemMap.set(schemaItemType, { loadTime, itemCount });
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Clears all log entries from the Map.
|
|
62
|
-
*/
|
|
63
|
-
clearLogs() {
|
|
64
|
-
this._iModelItems.clear();
|
|
65
|
-
}
|
|
66
|
-
getSchemaMap(iModel) {
|
|
67
|
-
if (!this._iModelItems.has(iModel)) {
|
|
68
|
-
this._iModelItems.set(iModel, new Map());
|
|
69
|
-
}
|
|
70
|
-
return this._iModelItems.get(iModel);
|
|
71
|
-
}
|
|
72
|
-
getSchemaLoadData(schemaMap, schemaName) {
|
|
73
|
-
if (!schemaMap.has(schemaName))
|
|
74
|
-
schemaMap.set(schemaName, { schemaItemMap: new Map() });
|
|
75
|
-
return schemaMap.get(schemaName);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
//# sourceMappingURL=PerformanceLogger.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PerformanceLogger.js","sourceRoot":"","sources":["../../../src/IncrementalLoading/PerformanceLogger.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAsBhG;;;;GAIG;AACH,MAAM,OAAO,iBAAiB;IACpB,YAAY,GAA6C,IAAI,GAAG,EAAE,CAAC;IACnE,MAAM,CAAS;IAEvB,4CAA4C;IACrC,cAAc,GAAG,KAAK,CAAC;IAE9B;;;OAGG;IACH,YAAY,KAAc;QACxB,IAAI,CAAC,MAAM,GAAG,KAAK,IAAI,EAAE,CAAC;IAC5B,CAAC;IAED;;;;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C,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QAC3C,CAAC;QAED,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAgC,CAAC;IACtE,CAAC;IAEO,iBAAiB,CAAC,SAAsC,EAAE,UAAkB;QAClF,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC;YAC5B,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,EAAE,aAAa,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC,CAAA;QAEzD,OAAO,SAAS,CAAC,GAAG,CAAC,UAAU,CAAmB,CAAC;IACrD,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * Contains the properties needed to track load times\n * for SchemaItem queries.\n * @internal\n */\nexport interface SchemaItemLoadData {\n loadTime: number,\n itemCount: number\n}\n\n/**\n * Contains the properties needed to track load times\n * for Schema queries.\n * @internal\n */\nexport interface SchemaLoadData {\n loadTime?: number,\n schemaItemMap: Map<string, SchemaItemLoadData>;\n}\n\n/**\n * Utility class used to log query load times for Schema and\n * SchemaItem queries.\n * @internal\n */\nexport class PerformanceLogger {\n private _iModelItems: Map<string, Map<string, SchemaLoadData>> = new Map();\n private _label: string;\n\n // flag that controls if logging is enabled.\n public disableLogging = false;\n\n /**\n * Initializes a new PerformanceLogger instance.\n * @param label Arbitrary label used to tag this logging session (ex. IModel name)\n */\n constructor(label?: string) {\n this._label = label || \"\";\n }\n\n /**\n * Gets the Map of logged Schema entries. The Map key is the iModel name. The Map\n * value is a second Map whose key is a Schema name and value is a SchemaLoadData\n * object.\n */\n public get logItems(): Map<string, Map<string, SchemaLoadData>> {\n return this._iModelItems;\n }\n\n /**\n * Adds a new log entry to the Schema Map.\n * @param startTime The start time of the entry to be logged (end time/duration is handled in this method).\n * @param schemaName The Schema being queried.\n */\n public logSchema(startTime: number, schemaName: string) {\n if (this.disableLogging)\n return;\n\n const loadTime = new Date().getTime() - startTime;\n\n const schemaMap = this.getSchemaMap(this._label);\n const schemaLoadData = this.getSchemaLoadData(schemaMap, schemaName);\n\n schemaLoadData.loadTime = loadTime;\n }\n\n /**\n * Adds a new log entry to the SchemaItem Map.\n * @param startTime The start time of the entry to be logged (end time/duration is handled in this method).\n * @param schemaName The name of the Schema being queried.\n * @param schemaItemType The SchemaItemType name of the type being queried.\n * @param itemCount The number of items retrieved in the query.\n */\n public logSchemaItem(startTime: number, schemaName: string, schemaItemType: string, itemCount: number) {\n if (this.disableLogging)\n return;\n\n const loadTime = new Date().getTime() - startTime;\n\n const schemaMap = this.getSchemaMap(this._label);\n const schemaLoadData = this.getSchemaLoadData(schemaMap, schemaName);\n\n if (schemaLoadData.schemaItemMap.has(schemaItemType))\n throw new Error(\"There should not be a multiple load times for a given iModel, Schema, SchemaItemType combination.\");\n\n schemaLoadData.schemaItemMap.set(schemaItemType, { loadTime, itemCount });\n }\n\n /**\n * Clears all log entries from the Map.\n */\n public clearLogs() {\n this._iModelItems.clear();\n }\n\n private getSchemaMap(iModel: string): Map<string, SchemaLoadData> {\n if (!this._iModelItems.has(iModel)) {\n this._iModelItems.set(iModel, new Map());\n }\n\n return this._iModelItems.get(iModel) as Map<string, SchemaLoadData>;\n }\n\n private getSchemaLoadData(schemaMap: Map<string, SchemaLoadData>, schemaName: string): SchemaLoadData {\n if (!schemaMap.has(schemaName))\n schemaMap.set(schemaName, { schemaItemMap: new Map() })\n\n return schemaMap.get(schemaName) as SchemaLoadData;\n }\n}"]}
|