@memlab/core 1.1.5 → 1.1.9

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.
Files changed (120) hide show
  1. package/dist/__tests__/parser/HeapParser.test.d.ts +1 -1
  2. package/dist/__tests__/parser/HeapParser.test.js +3 -3
  3. package/dist/__tests__/parser/NodeHeap.test.d.ts +1 -1
  4. package/dist/__tests__/parser/NodeHeap.test.js +6 -6
  5. package/dist/__tests__/parser/StringNode.test.d.ts +1 -1
  6. package/dist/__tests__/parser/StringNode.test.js +2 -2
  7. package/dist/__tests__/parser/traverse/HeapNodeTraverse.test.d.ts +1 -1
  8. package/dist/__tests__/parser/traverse/HeapNodeTraverse.test.js +3 -3
  9. package/dist/__tests__/utils/utils.test.d.ts +1 -1
  10. package/dist/__tests__/utils/utils.test.js +1 -1
  11. package/dist/index.d.ts +4 -2
  12. package/dist/index.js +6 -3
  13. package/dist/lib/BaseOption.d.ts +1 -1
  14. package/dist/lib/BaseOption.js +1 -1
  15. package/dist/lib/BrowserInfo.d.ts +1 -1
  16. package/dist/lib/BrowserInfo.js +1 -1
  17. package/dist/lib/Config.d.ts +11 -2
  18. package/dist/lib/Config.js +25 -5
  19. package/dist/lib/Console.d.ts +1 -1
  20. package/dist/lib/Console.js +1 -1
  21. package/dist/lib/Constant.d.ts +1 -1
  22. package/dist/lib/Constant.js +1 -1
  23. package/dist/lib/FileManager.d.ts +1 -1
  24. package/dist/lib/FileManager.js +5 -3
  25. package/dist/lib/HeapAnalyzer.d.ts +1 -1
  26. package/dist/lib/HeapAnalyzer.js +26 -10
  27. package/dist/lib/HeapParser.d.ts +2 -2
  28. package/dist/lib/HeapParser.js +2 -2
  29. package/dist/lib/InternalValueSetter.d.ts +1 -1
  30. package/dist/lib/InternalValueSetter.js +1 -1
  31. package/dist/lib/NodeHeap.d.ts +53 -10
  32. package/dist/lib/NodeHeap.js +73 -22
  33. package/dist/lib/PackageInfoLoader.js +2 -2
  34. package/dist/lib/ProcessManager.d.ts +1 -1
  35. package/dist/lib/ProcessManager.js +1 -1
  36. package/dist/lib/Serializer.d.ts +1 -1
  37. package/dist/lib/Serializer.js +49 -26
  38. package/dist/lib/StringLoader.d.ts +2 -2
  39. package/dist/lib/StringLoader.js +2 -2
  40. package/dist/lib/Types.d.ts +111 -36
  41. package/dist/lib/Types.js +1 -1
  42. package/dist/lib/Utils.d.ts +1 -1
  43. package/dist/lib/Utils.js +55 -31
  44. package/dist/lib/heap-data/HeapEdge.d.ts +2 -2
  45. package/dist/lib/heap-data/HeapEdge.js +2 -2
  46. package/dist/lib/heap-data/HeapLocation.d.ts +2 -2
  47. package/dist/lib/heap-data/HeapLocation.js +2 -2
  48. package/dist/lib/heap-data/HeapNode.d.ts +3 -2
  49. package/dist/lib/heap-data/HeapNode.js +6 -2
  50. package/dist/lib/heap-data/HeapSnapshot.d.ts +3 -2
  51. package/dist/lib/heap-data/HeapSnapshot.js +6 -33
  52. package/dist/lib/heap-data/HeapStringNode.d.ts +2 -2
  53. package/dist/lib/heap-data/HeapStringNode.js +4 -2
  54. package/dist/lib/heap-data/HeapUtils.d.ts +2 -2
  55. package/dist/lib/heap-data/HeapUtils.js +2 -2
  56. package/dist/lib/heap-data/MemLabTagStore.d.ts +23 -0
  57. package/dist/lib/heap-data/MemLabTagStore.js +110 -0
  58. package/dist/lib/leak-filters/BaseLeakFilter.rule.d.ts +1 -1
  59. package/dist/lib/leak-filters/BaseLeakFilter.rule.js +1 -1
  60. package/dist/lib/leak-filters/LeakFilterRuleList.d.ts +1 -1
  61. package/dist/lib/leak-filters/LeakFilterRuleList.js +1 -1
  62. package/dist/lib/leak-filters/LeakObjectFilter.d.ts +1 -1
  63. package/dist/lib/leak-filters/LeakObjectFilter.js +1 -1
  64. package/dist/lib/leak-filters/rules/FilterByExternalFilter.rule.d.ts +1 -1
  65. package/dist/lib/leak-filters/rules/FilterByExternalFilter.rule.js +1 -1
  66. package/dist/lib/leak-filters/rules/FilterDetachedDOMElement.rule.d.ts +1 -1
  67. package/dist/lib/leak-filters/rules/FilterDetachedDOMElement.rule.js +1 -1
  68. package/dist/lib/leak-filters/rules/FilterHermesNode.rule.d.ts +1 -1
  69. package/dist/lib/leak-filters/rules/FilterHermesNode.rule.js +1 -1
  70. package/dist/lib/leak-filters/rules/FilterOverSizedNodeAsLeak.rule.d.ts +1 -1
  71. package/dist/lib/leak-filters/rules/FilterOverSizedNodeAsLeak.rule.js +1 -1
  72. package/dist/lib/leak-filters/rules/FilterStackTraceFrame.rule.d.ts +1 -1
  73. package/dist/lib/leak-filters/rules/FilterStackTraceFrame.rule.js +1 -1
  74. package/dist/lib/leak-filters/rules/FilterTrivialNode.rule.d.ts +1 -1
  75. package/dist/lib/leak-filters/rules/FilterTrivialNode.rule.js +1 -1
  76. package/dist/lib/leak-filters/rules/FilterUnmountedFiberNode.rule.d.ts +1 -1
  77. package/dist/lib/leak-filters/rules/FilterUnmountedFiberNode.rule.js +1 -1
  78. package/dist/logger/LeakClusterLogger.d.ts +1 -1
  79. package/dist/logger/LeakClusterLogger.js +1 -1
  80. package/dist/logger/LeakTraceDetailsLogger.d.ts +1 -1
  81. package/dist/logger/LeakTraceDetailsLogger.js +1 -1
  82. package/dist/modes/BaseMode.d.ts +1 -1
  83. package/dist/modes/BaseMode.js +1 -1
  84. package/dist/modes/InteractionTestMode.d.ts +1 -1
  85. package/dist/modes/InteractionTestMode.js +1 -1
  86. package/dist/modes/MeasureMode.d.ts +1 -1
  87. package/dist/modes/MeasureMode.js +1 -1
  88. package/dist/modes/RunningModes.d.ts +1 -1
  89. package/dist/modes/RunningModes.js +1 -1
  90. package/dist/paths/TraceFinder.d.ts +1 -1
  91. package/dist/paths/TraceFinder.js +41 -42
  92. package/dist/trace-cluster/ClusterUtils.d.ts +1 -1
  93. package/dist/trace-cluster/ClusterUtils.js +1 -1
  94. package/dist/trace-cluster/ClusterUtilsHelper.d.ts +1 -1
  95. package/dist/trace-cluster/ClusterUtilsHelper.js +1 -1
  96. package/dist/trace-cluster/ClusteringHeuristics.d.ts +1 -1
  97. package/dist/trace-cluster/ClusteringHeuristics.js +1 -1
  98. package/dist/trace-cluster/EvalutationMetric.d.ts +1 -1
  99. package/dist/trace-cluster/EvalutationMetric.js +1 -1
  100. package/dist/trace-cluster/SequentialClustering.d.ts +17 -0
  101. package/dist/trace-cluster/SequentialClustering.js +47 -0
  102. package/dist/trace-cluster/TraceBucket.d.ts +2 -1
  103. package/dist/trace-cluster/TraceBucket.js +10 -2
  104. package/dist/trace-cluster/TraceElement.d.ts +3 -1
  105. package/dist/trace-cluster/TraceElement.js +7 -1
  106. package/dist/trace-cluster/strategies/MLTraceSimilarityStrategy.d.ts +15 -0
  107. package/dist/trace-cluster/strategies/MLTraceSimilarityStrategy.js +61 -0
  108. package/dist/trace-cluster/strategies/TraceAsClusterStrategy.d.ts +1 -1
  109. package/dist/trace-cluster/strategies/TraceAsClusterStrategy.js +1 -1
  110. package/dist/trace-cluster/strategies/TraceSimilarityStrategy.d.ts +1 -1
  111. package/dist/trace-cluster/strategies/TraceSimilarityStrategy.js +1 -1
  112. package/dist/trace-cluster/strategies/machine-learning/DistanceMatrix.d.ts +11 -0
  113. package/dist/trace-cluster/strategies/machine-learning/DistanceMatrix.js +54 -0
  114. package/dist/trace-cluster/strategies/machine-learning/HAC.d.ts +17 -0
  115. package/dist/trace-cluster/strategies/machine-learning/HAC.js +122 -0
  116. package/dist/trace-cluster/strategies/machine-learning/Ngram.d.ts +11 -0
  117. package/dist/trace-cluster/strategies/machine-learning/Ngram.js +22 -0
  118. package/dist/trace-cluster/strategies/machine-learning/TfidfVectorizer.d.ts +38 -0
  119. package/dist/trace-cluster/strategies/machine-learning/TfidfVectorizer.js +144 -0
  120. package/package.json +1 -1
@@ -4,8 +4,8 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @emails oncall+ws_labs
8
7
  * @format
8
+ * @oncall ws_labs
9
9
  */
10
10
  export {};
11
11
  //# sourceMappingURL=HeapParser.test.d.ts.map
@@ -5,8 +5,8 @@
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  *
8
- * @emails oncall+ws_labs
9
8
  * @format
9
+ * @oncall ws_labs
10
10
  */
11
11
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
12
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -36,7 +36,7 @@ test('Capture inserted object', () => __awaiter(void 0, void 0, void 0, function
36
36
  }
37
37
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
38
38
  const injected = new TestObject();
39
- const heap = yield (0, NodeHeap_1.getNodeInnocentHeap)();
39
+ const heap = yield (0, NodeHeap_1.takeNodeMinimalHeap)();
40
40
  expect(heap.hasObjectWithClassName('TestObject')).toBe(true);
41
41
  }), timeout);
42
42
  test('Does not capture transcient object', () => __awaiter(void 0, void 0, void 0, function* () {
@@ -49,6 +49,6 @@ test('Does not capture transcient object', () => __awaiter(void 0, void 0, void
49
49
  let injected = new TestObject();
50
50
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
51
51
  injected = null;
52
- const heap = yield (0, NodeHeap_1.getNodeInnocentHeap)();
52
+ const heap = yield (0, NodeHeap_1.takeNodeMinimalHeap)();
53
53
  expect(heap.hasObjectWithClassName('TestObject')).toBe(false);
54
54
  }), timeout);
@@ -4,8 +4,8 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @emails oncall+ws_labs
8
7
  * @format
8
+ * @oncall ws_labs
9
9
  */
10
10
  export {};
11
11
  //# sourceMappingURL=NodeHeap.test.d.ts.map
@@ -5,8 +5,8 @@
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  *
8
- * @emails oncall+ws_labs
9
8
  * @format
9
+ * @oncall ws_labs
10
10
  */
11
11
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
12
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -30,7 +30,7 @@ const timeout = 5 * 60 * 1000;
30
30
  test('Capture current node heap snapshot', () => __awaiter(void 0, void 0, void 0, function* () {
31
31
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
32
32
  const object = { 'memlab-test-heap-property': 'memlab-test-heap-value' };
33
- const heap = yield (0, NodeHeap_1.getNodeInnocentHeap)();
33
+ const heap = yield (0, NodeHeap_1.takeNodeMinimalHeap)();
34
34
  expect(heap.hasObjectWithPropertyName('memlab-test-heap-property')).toBe(true);
35
35
  }), timeout);
36
36
  test('Nullified Object should not exist in heap', () => __awaiter(void 0, void 0, void 0, function* () {
@@ -39,7 +39,7 @@ test('Nullified Object should not exist in heap', () => __awaiter(void 0, void 0
39
39
  };
40
40
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
41
41
  object = null;
42
- const heap = yield (0, NodeHeap_1.getNodeInnocentHeap)();
42
+ const heap = yield (0, NodeHeap_1.takeNodeMinimalHeap)();
43
43
  expect(heap.hasObjectWithPropertyName('memlab-test-heap-property')).toBe(false);
44
44
  }), timeout);
45
45
  test('Strongly referenced object should exist in heap', () => __awaiter(void 0, void 0, void 0, function* () {
@@ -59,7 +59,7 @@ test('Strongly referenced object should exist in heap', () => __awaiter(void 0,
59
59
  }
60
60
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
61
61
  const object = buildTest();
62
- const heap = yield (0, NodeHeap_1.getNodeInnocentHeap)();
62
+ const heap = yield (0, NodeHeap_1.takeNodeMinimalHeap)();
63
63
  expect(heap.hasObjectWithClassName('TestClass1')).toBe(true);
64
64
  expect(heap.hasObjectWithClassName('TestClass2')).toBe(true);
65
65
  }), timeout);
@@ -80,7 +80,7 @@ test('Weakly referenced object should not exist in heap', () => __awaiter(void 0
80
80
  }
81
81
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
82
82
  const object = buildTest();
83
- const heap = yield (0, NodeHeap_1.getNodeInnocentHeap)();
83
+ const heap = yield (0, NodeHeap_1.takeNodeMinimalHeap)();
84
84
  expect(heap.hasObjectWithClassName('TestClass3')).toBe(true);
85
85
  expect(heap.hasObjectWithClassName('TestClass4')).toBe(false);
86
86
  }), timeout);
@@ -90,7 +90,7 @@ test('Check annotated objects', () => __awaiter(void 0, void 0, void 0, function
90
90
  (0, NodeHeap_1.tagObject)(o1, 'memlab-mark-1');
91
91
  (0, NodeHeap_1.tagObject)(o2, 'memlab-mark-2');
92
92
  o2 = null;
93
- const heap = yield (0, NodeHeap_1.getNodeInnocentHeap)();
93
+ const heap = yield (0, NodeHeap_1.takeNodeMinimalHeap)();
94
94
  expect(heap.hasObjectWithTag('memlab-mark-1')).toBe(true);
95
95
  expect(heap.hasObjectWithTag('memlab-mark-2')).toBe(false);
96
96
  }), timeout);
@@ -4,8 +4,8 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @emails oncall+ws_labs
8
7
  * @format
8
+ * @oncall ws_labs
9
9
  */
10
10
  export {};
11
11
  //# sourceMappingURL=StringNode.test.d.ts.map
@@ -5,8 +5,8 @@
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  *
8
- * @emails oncall+ws_labs
9
8
  * @format
9
+ * @oncall ws_labs
10
10
  */
11
11
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
12
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -41,7 +41,7 @@ test('String heap object APIs work', () => __awaiter(void 0, void 0, void 0, fun
41
41
  injected.complexConcatString += 'value_';
42
42
  injected.complexConcatString += 123;
43
43
  injected.complexConcatString += '_suffix';
44
- const heap = yield (0, NodeHeap_1.getNodeInnocentHeap)();
44
+ const heap = yield (0, NodeHeap_1.takeNodeMinimalHeap)();
45
45
  const testObject = heap.getAnyObjectWithClassName('TestObject');
46
46
  expect(testObject).not.toBe(null);
47
47
  // testObject.originalString === 'test'
@@ -4,8 +4,8 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @emails oncall+ws_labs
8
7
  * @format
8
+ * @oncall ws_labs
9
9
  */
10
10
  import type { AnyValue } from '../../../lib/Types';
11
11
  declare global {
@@ -5,8 +5,8 @@
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  *
8
- * @emails oncall+ws_labs
9
8
  * @format
9
+ * @oncall ws_labs
10
10
  */
11
11
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
12
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -74,7 +74,7 @@ test('Check getReference and getReferenceNode', () => __awaiter(void 0, void 0,
74
74
  });
75
75
  return detected;
76
76
  };
77
- const heap = yield (0, NodeHeap_1.getNodeInnocentHeap)();
77
+ const heap = yield (0, NodeHeap_1.takeNodeMinimalHeap)();
78
78
  expect(checker(heap)).toBe(true);
79
79
  }), timeout);
80
80
  test('Check getReferrers and getReferrerNodes', () => __awaiter(void 0, void 0, void 0, function* () {
@@ -135,6 +135,6 @@ test('Check getReferrers and getReferrerNodes', () => __awaiter(void 0, void 0,
135
135
  }
136
136
  return true;
137
137
  };
138
- const heap = yield (0, NodeHeap_1.getNodeInnocentHeap)();
138
+ const heap = yield (0, NodeHeap_1.takeNodeMinimalHeap)();
139
139
  expect(checker(heap)).toBe(true);
140
140
  }), timeout);
@@ -4,8 +4,8 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @emails oncall+ws_labs
8
7
  * @format
8
+ * @oncall ws_labs
9
9
  */
10
10
  export {};
11
11
  //# sourceMappingURL=utils.test.d.ts.map
@@ -5,8 +5,8 @@
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  *
8
- * @emails oncall+ws_labs
9
8
  * @format
9
+ * @oncall ws_labs
10
10
  */
11
11
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
12
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
package/dist/index.d.ts CHANGED
@@ -4,12 +4,13 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @emails oncall+ws_labs
8
7
  * @format
8
+ * @oncall ws_labs
9
9
  */
10
10
  /** @internal */
11
11
  export declare function registerPackage(): Promise<void>;
12
12
  export * from './lib/Types';
13
+ export * from './lib/NodeHeap';
13
14
  /** @internal */
14
15
  export { default as config } from './lib/Config';
15
16
  /** @internal */
@@ -46,5 +47,6 @@ export { default as NormalizedTrace } from './trace-cluster/TraceBucket';
46
47
  export { default as EvaluationMetric } from './trace-cluster/EvalutationMetric';
47
48
  /** @internal */
48
49
  export * from './lib/PackageInfoLoader';
49
- export * from './lib/NodeHeap';
50
+ /** @internal */
51
+ export { default as SequentialClustering } from './trace-cluster/SequentialClustering';
50
52
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -5,8 +5,8 @@
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  *
8
- * @emails oncall+ws_labs
9
8
  * @format
9
+ * @oncall ws_labs
10
10
  */
11
11
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
12
12
  if (k2 === undefined) k2 = k;
@@ -35,7 +35,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35
35
  return (mod && mod.__esModule) ? mod : { "default": mod };
36
36
  };
37
37
  Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.EvaluationMetric = exports.NormalizedTrace = exports.leakClusterLogger = exports.ProcessManager = exports.modes = exports.constant = exports.analysis = exports.browserInfo = exports.serializer = exports.fileManager = exports.utils = exports.BaseOption = exports.info = exports.config = exports.registerPackage = void 0;
38
+ exports.SequentialClustering = exports.EvaluationMetric = exports.NormalizedTrace = exports.leakClusterLogger = exports.ProcessManager = exports.modes = exports.constant = exports.analysis = exports.browserInfo = exports.serializer = exports.fileManager = exports.utils = exports.BaseOption = exports.info = exports.config = exports.registerPackage = void 0;
39
39
  const path_1 = __importDefault(require("path"));
40
40
  const PackageInfoLoader_1 = require("./lib/PackageInfoLoader");
41
41
  /** @internal */
@@ -46,6 +46,7 @@ function registerPackage() {
46
46
  }
47
47
  exports.registerPackage = registerPackage;
48
48
  __exportStar(require("./lib/Types"), exports);
49
+ __exportStar(require("./lib/NodeHeap"), exports);
49
50
  /** @internal */
50
51
  var Config_1 = require("./lib/Config");
51
52
  Object.defineProperty(exports, "config", { enumerable: true, get: function () { return __importDefault(Config_1).default; } });
@@ -96,4 +97,6 @@ var EvalutationMetric_1 = require("./trace-cluster/EvalutationMetric");
96
97
  Object.defineProperty(exports, "EvaluationMetric", { enumerable: true, get: function () { return __importDefault(EvalutationMetric_1).default; } });
97
98
  /** @internal */
98
99
  __exportStar(require("./lib/PackageInfoLoader"), exports);
99
- __exportStar(require("./lib/NodeHeap"), exports);
100
+ /** @internal */
101
+ var SequentialClustering_1 = require("./trace-cluster/SequentialClustering");
102
+ Object.defineProperty(exports, "SequentialClustering", { enumerable: true, get: function () { return __importDefault(SequentialClustering_1).default; } });
@@ -4,8 +4,8 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @emails oncall+ws_labs
8
7
  * @format
8
+ * @oncall ws_labs
9
9
  */
10
10
  import type { ParsedArgs } from 'minimist';
11
11
  import type { AnyRecord } from './Types';
@@ -5,8 +5,8 @@
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  *
8
- * @emails oncall+ws_labs
9
8
  * @format
9
+ * @oncall ws_labs
10
10
  */
11
11
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
12
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -4,8 +4,8 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @emails oncall+ws_labs
8
7
  * @format
8
+ * @oncall ws_labs
9
9
  */
10
10
  import type { ConsoleMessage, Dialog, LaunchOptions, Page } from 'puppeteer';
11
11
  import type { IBrowserInfo } from './Types';
@@ -5,8 +5,8 @@
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  *
8
- * @emails oncall+ws_labs
9
8
  * @format
9
+ * @oncall ws_labs
10
10
  */
11
11
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
12
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -4,11 +4,12 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @emails oncall+ws_labs
8
7
  * @format
8
+ * @oncall ws_labs
9
9
  */
10
10
  import type { LaunchOptions, Permission } from 'puppeteer';
11
11
  import type { AnyFunction, AnyValue, IClusterStrategy, IRunningMode, IScenario, Nullable, Optional, QuickExperiment, ILeakFilter, IPackageInfo } from './Types';
12
+ import { IHeapConfig } from '..';
12
13
  interface BrowserLaunchArgumentOptions {
13
14
  headless?: boolean;
14
15
  userDataDir?: string;
@@ -52,7 +53,6 @@ export declare class MemLabConfig {
52
53
  _scenario: Optional<IScenario>;
53
54
  _isHeadfulBrowser: boolean;
54
55
  _browser: string;
55
- _packageInfo: IPackageInfo[];
56
56
  snapshotHasDetachedness: boolean;
57
57
  specifiedEngine: boolean;
58
58
  verbose: boolean;
@@ -96,6 +96,7 @@ export declare class MemLabConfig {
96
96
  dataBuilderDataDir: string;
97
97
  unclassifiedClusterDir: string;
98
98
  externalCookiesFile: Optional<string>;
99
+ heapConfig: Optional<IHeapConfig>;
99
100
  puppeteerConfig: LaunchOptions & BrowserLaunchArgumentOptions & BrowserConnectOptions;
100
101
  openDevtoolsConsole: boolean;
101
102
  emulateDevice: Nullable<Device>;
@@ -176,9 +177,17 @@ export declare class MemLabConfig {
176
177
  externalLeakFilter?: Optional<ILeakFilter>;
177
178
  monoRepoDir: string;
178
179
  muteConsole: boolean;
180
+ includeObjectInfoInTraceReturnChain: boolean;
179
181
  logUnclassifiedClusters: boolean;
180
182
  errorHandling: ErrorHandling;
181
183
  clusterStrategy: Optional<IClusterStrategy>;
184
+ packageInfo: IPackageInfo[];
185
+ isMLClustering: boolean;
186
+ mlClusteringLinkageMaxDistance: number;
187
+ mlMaxDF: number;
188
+ isSequentialClustering: boolean;
189
+ seqClusteringSplitCount: number;
190
+ seqClusteringIsRandomChunks: boolean;
182
191
  constructor(options?: ConfigOption);
183
192
  private initInternalConfigs;
184
193
  private init;
@@ -5,8 +5,8 @@
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  *
8
- * @emails oncall+ws_labs
9
8
  * @format
9
+ * @oncall ws_labs
10
10
  */
11
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
@@ -58,13 +58,15 @@ class MemLabConfig {
58
58
  this.targetApp = Constant_1.default.unset;
59
59
  this.targetTab = Constant_1.default.unset;
60
60
  this.analysisMode = Constant_1.default.unset;
61
- this.focusFiberNodeId = 1;
61
+ this.focusFiberNodeId = -1;
62
62
  this.isFB = Constant_1.default.isFB;
63
63
  // assuming the Evn doesn't support Xvfb before checking
64
64
  this.machineSupportsXVFB = false;
65
65
  // by default we want to use Xvfb if the Env supports it
66
66
  this.useXVFB = true;
67
67
  this.specifiedEngine = false;
68
+ // set by the heap-analysis package if HeapConfig is used
69
+ this.heapConfig = null;
68
70
  // set puppeteer configuration
69
71
  this.puppeteerConfig = {
70
72
  headless: !this._isHeadfulBrowser,
@@ -98,7 +100,7 @@ class MemLabConfig {
98
100
  // the default browser (Chromium)
99
101
  this._browser = 'chrome';
100
102
  // a list of package information
101
- this._packageInfo = [];
103
+ this.packageInfo = [];
102
104
  // a set of additional GKs to be enabled
103
105
  this.addEnableGK = new Set();
104
106
  // a set of additional GKs to be disabled
@@ -119,8 +121,26 @@ class MemLabConfig {
119
121
  this.muteConsole = false;
120
122
  // log all leak traces, each as an unclassified cluster
121
123
  this.logUnclassifiedClusters = false;
124
+ // If true, the detailed JSON file of each representative
125
+ // trace (for visualization) will include detailed object
126
+ // info for each Fiber node on the return chain.
127
+ // This may bloat the trace size from 100KB to 50MB.
128
+ this.includeObjectInfoInTraceReturnChain = false;
122
129
  // by default halt the program when utils.haltOrThrow is calleds
123
130
  this.errorHandling = ErrorHandling.Halt;
131
+ // by default use clustering based on heurastics
132
+ this.isMLClustering = false;
133
+ // linkage max distance for caclulating distances among clusters
134
+ this.mlClusteringLinkageMaxDistance = 0.7;
135
+ // TF/IDF maximum document frequency
136
+ this.mlMaxDF = 1;
137
+ // if true, evaluating results with sequential clustering
138
+ this.isSequentialClustering = false;
139
+ // split the sample leak traces into 4 smaller ones by default.
140
+ this.seqClusteringSplitCount = 4;
141
+ // if true, split dataset into trunks
142
+ // with random order for sequential clustering
143
+ this.seqClusteringIsRandomChunks = false;
124
144
  }
125
145
  // initialize configurable parameters
126
146
  init(options = {}) {
@@ -165,9 +185,9 @@ class MemLabConfig {
165
185
  // the # of retries when initial load fails
166
186
  this.initialLoadFailRetry = 2;
167
187
  // timeout for checking the presence of non-optional click target
168
- this.presenceCheckTimeout = 120000;
188
+ this.presenceCheckTimeout = 2 * 60 * 1000;
169
189
  // default waiting time before exit when exception occurs during page interaction
170
- this.delayBeforeExitUponException = 120 * 1000;
190
+ this.delayBeforeExitUponException = 2 * 60 * 1000;
171
191
  // Chrome window width
172
192
  this.windowWidth = windowWidth;
173
193
  // Chrome window height
@@ -4,8 +4,8 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @emails oncall+ws_labs
8
7
  * @format
8
+ * @oncall ws_labs
9
9
  */
10
10
  import { Chalk } from 'chalk';
11
11
  import type { MemLabConfig } from './Config';
@@ -4,8 +4,8 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @emails oncall+ws_labs
8
7
  * @format
8
+ * @oncall ws_labs
9
9
  */
10
10
  'use strict';
11
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
@@ -4,8 +4,8 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @emails oncall+ws_labs
8
7
  * @format
8
+ * @oncall ws_labs
9
9
  */
10
10
  declare const constants: {
11
11
  isFB: boolean;
@@ -5,8 +5,8 @@
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  *
8
- * @emails oncall+ws_labs
9
8
  * @format
9
+ * @oncall ws_labs
10
10
  */
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const InternalValueSetter_1 = require("./InternalValueSetter");
@@ -4,8 +4,8 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @emails oncall+ws_labs
8
7
  * @format
8
+ * @oncall ws_labs
9
9
  */
10
10
  import type { MemLabConfig } from './Config';
11
11
  import type { AnyValue, Optional } from './Types';
@@ -5,8 +5,8 @@
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  *
8
- * @emails oncall+ws_labs
9
8
  * @format
9
+ * @oncall ws_labs
10
10
  */
11
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
@@ -41,8 +41,10 @@ class FileManager {
41
41
  return path_1.default.join(this.getTmpDir(), 'memlab');
42
42
  }
43
43
  generateTmpHeapDir() {
44
- const dirPath = path_1.default.join(this.getTmpDir(), Utils_1.default.getUniqueID());
45
- fs_extra_1.default.mkdirSync(dirPath);
44
+ const dirPath = path_1.default.join(this.getTmpDir(), 'memlab-' + Utils_1.default.getUniqueID());
45
+ if (!fs_extra_1.default.existsSync(dirPath)) {
46
+ fs_extra_1.default.mkdirSync(dirPath);
47
+ }
46
48
  return dirPath;
47
49
  }
48
50
  getWorkDir(options = {}) {
@@ -4,8 +4,8 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @emails oncall+ws_labs
8
7
  * @format
8
+ * @oncall ws_labs
9
9
  */
10
10
  import type { E2EStepInfo, HeapNodeIdSet, IHeapNode, IHeapSnapshot, IMemoryAnalystOptions, IMemoryAnalystSnapshotDiff, LeakTracePathItem, Optional, IOveralLeakInfo, TraceCluster, ISerializedInfo } from './Types';
11
11
  import TraceFinder from '../paths/TraceFinder';
@@ -4,8 +4,8 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @emails oncall+ws_labs
8
7
  * @format
8
+ * @oncall ws_labs
9
9
  */
10
10
  'use strict';
11
11
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
@@ -33,6 +33,7 @@ const Console_1 = __importDefault(require("./Console"));
33
33
  const Serializer_1 = __importDefault(require("./Serializer"));
34
34
  const Utils_1 = __importDefault(require("./Utils"));
35
35
  const LeakObjectFilter_1 = require("./leak-filters/LeakObjectFilter");
36
+ const MLTraceSimilarityStrategy_1 = __importDefault(require("../trace-cluster/strategies/MLTraceSimilarityStrategy"));
36
37
  class MemoryAnalyst {
37
38
  checkLeak() {
38
39
  return __awaiter(this, void 0, void 0, function* () {
@@ -249,9 +250,17 @@ class MemoryAnalyst {
249
250
  let snapshotLeakedHeapNodeIdSet = new Set();
250
251
  let nodeIdsInSnapshots = [];
251
252
  let snapshot;
253
+ // if specified a heap file
252
254
  if (options.file) {
253
255
  const opt = { buildNodeIdIndex: true, verbose: true };
254
256
  snapshot = yield Utils_1.default.getSnapshotFromFile(options.file, opt);
257
+ // if running in interactive heap analysis mode
258
+ }
259
+ else if (Config_1.default.heapConfig &&
260
+ Config_1.default.heapConfig.isCliInteractiveMode &&
261
+ Config_1.default.heapConfig.currentHeap) {
262
+ snapshot = Config_1.default.heapConfig.currentHeap;
263
+ // otherwise diff heap snapshots
255
264
  }
256
265
  else {
257
266
  Utils_1.default.checkSnapshots();
@@ -367,14 +376,17 @@ class MemoryAnalyst {
367
376
  // initialize the path finder
368
377
  preparePathFinder(snapshot) {
369
378
  const finder = new TraceFinder_1.default();
370
- // shortest path for all nodes
371
- finder.annotateShortestPaths(snapshot);
372
- // dominator and retained size
373
- finder.calculateAllNodesRetainedSizes(snapshot);
374
- // mark detached Fiber nodes
375
- Utils_1.default.markAllDetachedFiberNode(snapshot);
376
- // mark alternate Fiber nodes
377
- Utils_1.default.markAlternateFiberNode(snapshot);
379
+ if (!snapshot.isProcessed) {
380
+ // shortest path for all nodes
381
+ finder.annotateShortestPaths(snapshot);
382
+ // dominator and retained size
383
+ finder.calculateAllNodesRetainedSizes(snapshot);
384
+ // mark detached Fiber nodes
385
+ Utils_1.default.markAllDetachedFiberNode(snapshot);
386
+ // mark alternate Fiber nodes
387
+ Utils_1.default.markAlternateFiberNode(snapshot);
388
+ snapshot.isProcessed = true;
389
+ }
378
390
  return finder;
379
391
  }
380
392
  // summarize the page interaction and dump to the leak text summary file
@@ -630,7 +642,11 @@ class MemoryAnalyst {
630
642
  Console_1.default.midLevel(`${numOfLeakedObjects} leaked objects`);
631
643
  }
632
644
  // cluster traces from the current run
633
- const clusters = TraceBucket_1.default.clusterPaths(paths, snapshot, this.aggregateDominatorMetrics);
645
+ const clusters = TraceBucket_1.default.clusterPaths(paths, snapshot, this.aggregateDominatorMetrics, {
646
+ strategy: Config_1.default.isMLClustering
647
+ ? new MLTraceSimilarityStrategy_1.default()
648
+ : undefined,
649
+ });
634
650
  yield this.serializeClusterUpdate(clusters);
635
651
  if (Config_1.default.logUnclassifiedClusters) {
636
652
  // cluster traces from the current run
@@ -4,9 +4,9 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @emails oncall+ws_labs
8
- * @lightSyntaxTransform
9
7
  * @format
8
+ * @lightSyntaxTransform
9
+ * @oncall ws_labs
10
10
  */
11
11
  import type { IHeapSnapshot } from './Types';
12
12
  declare function getNodeIdsFromFile(file: string, _options?: {}): Promise<Set<number>>;
@@ -4,9 +4,9 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @emails oncall+ws_labs
8
- * @lightSyntaxTransform
9
7
  * @format
8
+ * @lightSyntaxTransform
9
+ * @oncall ws_labs
10
10
  */
11
11
  'use strict';
12
12
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
@@ -4,8 +4,8 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @emails oncall+ws_labs
8
7
  * @format
8
+ * @oncall ws_labs
9
9
  */
10
10
  /** @internal */
11
11
  export declare abstract class InternalValueSetter<T> {
@@ -5,8 +5,8 @@
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  *
8
- * @emails oncall+ws_labs
9
8
  * @format
9
+ * @oncall ws_labs
10
10
  */
11
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };