@memlab/core
Advanced tools
Comparing version 1.1.14 to 1.1.16
@@ -53,3 +53,7 @@ /** | ||
/** @internal */ | ||
export { default as MultiIterationSeqClustering } from './trace-cluster/MultiIterationSeqClustering'; | ||
/** @internal */ | ||
export { default as TraceFinder } from './paths/TraceFinder'; | ||
/** @internal */ | ||
export * from './trace-cluster/ClusterUtils'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -38,3 +38,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TraceFinder = 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; | ||
exports.TraceFinder = exports.MultiIterationSeqClustering = 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; | ||
const path_1 = __importDefault(require("path")); | ||
@@ -105,3 +105,8 @@ const PackageInfoLoader_1 = require("./lib/PackageInfoLoader"); | ||
/** @internal */ | ||
var MultiIterationSeqClustering_1 = require("./trace-cluster/MultiIterationSeqClustering"); | ||
Object.defineProperty(exports, "MultiIterationSeqClustering", { enumerable: true, get: function () { return __importDefault(MultiIterationSeqClustering_1).default; } }); | ||
/** @internal */ | ||
var TraceFinder_1 = require("./paths/TraceFinder"); | ||
Object.defineProperty(exports, "TraceFinder", { enumerable: true, get: function () { return __importDefault(TraceFinder_1).default; } }); | ||
/** @internal */ | ||
__exportStar(require("./trace-cluster/ClusterUtils"), exports); |
@@ -191,5 +191,9 @@ /** | ||
isSequentialClustering: boolean; | ||
isMultiIterationSeqClustering: boolean; | ||
seqClusteringSplitCount: number; | ||
multiIterSeqClusteringIteration: number; | ||
multiIterSeqClusteringSampleSize: number; | ||
seqClusteringIsRandomChunks: boolean; | ||
instrumentJS: boolean; | ||
interceptScript: boolean; | ||
constructor(options?: ConfigOption); | ||
@@ -196,0 +200,0 @@ private initInternalConfigs; |
@@ -119,3 +119,5 @@ "use strict"; | ||
this.runningMode = RunningModes_1.default.get('regular', this); | ||
// intercept and rewrite JavaScript Code in browser | ||
// intercept and log JavaScript Code in browser | ||
this.interceptScript = false; | ||
// rewrite JavaScript Code in browser | ||
this.instrumentJS = false; | ||
@@ -143,4 +145,11 @@ // external heap snapshot paths, if enabled | ||
this.isSequentialClustering = false; | ||
// if true, evaluating results with sequential | ||
// clustering with multiple iterations | ||
this.isMultiIterationSeqClustering = false; | ||
// split the sample leak traces into 4 smaller ones by default. | ||
this.seqClusteringSplitCount = 4; | ||
// the number of iterations for multi-iteration sequential clustering | ||
this.multiIterSeqClusteringIteration = 1; | ||
// the number of trace samples to retain from each cluster | ||
this.multiIterSeqClusteringSampleSize = Infinity; | ||
// if true, split dataset into trunks | ||
@@ -147,0 +156,0 @@ // with random order for sequential clustering |
@@ -277,3 +277,3 @@ "use strict"; | ||
const info = Object.create(null); | ||
const key = 'variables in scope (used by nested closures)'; | ||
const key = 'variables in defining scope (used by nested closures)'; | ||
const closure_vars = (info[key] = Object.create(null)); | ||
@@ -280,0 +280,0 @@ iterateSelectedEdges(node, (edge) => { |
@@ -543,3 +543,6 @@ "use strict"; | ||
} | ||
return Constant_1.default.namePrefixForScenarioFromFile + '-' + scenario.name(); | ||
if (Constant_1.default.namePrefixForScenarioFromFile.length > 0) { | ||
return Constant_1.default.namePrefixForScenarioFromFile + '-' + scenario.name(); | ||
} | ||
return scenario.name(); | ||
} | ||
@@ -825,4 +828,7 @@ function handleSnapshotError(e) { | ||
function hasOnlyWeakReferrers(node) { | ||
const referrer = node.findAnyReferrer((edge) => edge.type !== 'weak' && edge.type !== 'shortcut'); | ||
return !!referrer; | ||
const referrer = node.findAnyReferrer( | ||
// shortcut references are added by JS engine | ||
// GC won't consider shortcut as a retaining edge | ||
(edge) => edge.type !== 'weak' && edge.type !== 'shortcut'); | ||
return referrer == null; | ||
} | ||
@@ -829,0 +835,0 @@ function getRunMetaFilePath() { |
@@ -10,6 +10,20 @@ /** | ||
*/ | ||
import type { LeakTrace } from '../lib/Types'; | ||
declare const _default: { | ||
isSimilarTrace: (t1: import("..").LeakTrace, t2: import("..").LeakTrace) => boolean; | ||
isSimilarTrace: (t1: LeakTrace, t2: LeakTrace) => boolean; | ||
}; | ||
export default _default; | ||
/** | ||
* const elements = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | ||
* randomChunks(elements, 3) -> [[4, 8, 3], [9, 5, 1], [2, 6, 7, 10]] | ||
* @internal | ||
*/ | ||
export declare const randomChunks: <T>(items: T[], n: number) => T[][]; | ||
/** | ||
* chunks(elements, 3) -> [[1, 2, 3], [4, 5, 6], [7, 8, 9, 10]] | ||
* @internal | ||
*/ | ||
export declare const chunks: <T>(items: T[], n: number) => T[][]; | ||
/** @internal*/ | ||
export declare const lastNodeFromTrace: (trace: LeakTrace) => import("../lib/Types").LeakTraceElement; | ||
//# sourceMappingURL=ClusterUtils.d.ts.map |
@@ -15,4 +15,46 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.lastNodeFromTrace = exports.chunks = exports.randomChunks = void 0; | ||
const ClusterUtilsHelper_1 = __importDefault(require("./ClusterUtilsHelper")); | ||
const ClusteringHeuristics_1 = __importDefault(require("./ClusteringHeuristics")); | ||
exports.default = ClusterUtilsHelper_1.default.initialize(ClusteringHeuristics_1.default); | ||
/** | ||
* const elements = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | ||
* randomChunks(elements, 3) -> [[4, 8, 3], [9, 5, 1], [2, 6, 7, 10]] | ||
* @internal | ||
*/ | ||
const randomChunks = (items, n) => { | ||
const array = [...items]; | ||
const size = Math.floor(array.length / n); | ||
const chunks = []; | ||
for (let i = 0; i < n - 1; i++) { | ||
const chunk = []; | ||
for (let j = 0; j < size; j++) { | ||
const idx = Math.floor(Math.random() * array.length); | ||
chunk[j] = array[idx]; | ||
array.splice(idx, 1); | ||
} | ||
chunks.push(chunk); | ||
} | ||
chunks.push(array); | ||
return chunks; | ||
}; | ||
exports.randomChunks = randomChunks; | ||
/** | ||
* chunks(elements, 3) -> [[1, 2, 3], [4, 5, 6], [7, 8, 9, 10]] | ||
* @internal | ||
*/ | ||
const chunks = (items, n) => { | ||
const array = [...items]; | ||
const size = Math.floor(array.length / n); | ||
const chunks = []; | ||
for (let i = 0; i < n - 1; i++) { | ||
const chunk = array.splice(0, size); | ||
chunks.push(chunk); | ||
} | ||
chunks.push(array); | ||
return chunks; | ||
}; | ||
exports.chunks = chunks; | ||
/** @internal*/ | ||
const lastNodeFromTrace = (trace) => trace[trace.length - 1]; | ||
exports.lastNodeFromTrace = lastNodeFromTrace; |
@@ -24,2 +24,3 @@ "use strict"; | ||
const MLTraceSimilarityStrategy_1 = __importDefault(require("./strategies/MLTraceSimilarityStrategy")); | ||
const ClusterUtils_1 = require("./ClusterUtils"); | ||
// sync up with html/intern/js/webspeed/memlab/lib/LeakCluster.js | ||
@@ -170,6 +171,5 @@ class NormalizedTrace { | ||
static clusteredLeakTracesToRecord(allClusters) { | ||
const lastNodeFromTrace = (trace) => trace[trace.length - 1]; | ||
const labaledLeakTraces = allClusters.reduce((acc, bucket) => { | ||
const lastNodeFromFirstTrace = lastNodeFromTrace(bucket[0]); | ||
bucket.map(lastNodeFromTrace).forEach(lastNodeInTrace => { | ||
const lastNodeFromFirstTrace = (0, ClusterUtils_1.lastNodeFromTrace)(bucket[0]); | ||
bucket.map(ClusterUtils_1.lastNodeFromTrace).forEach(lastNodeInTrace => { | ||
if (lastNodeInTrace.id == null || lastNodeFromFirstTrace.id == null) { | ||
@@ -176,0 +176,0 @@ throw new Error('node id not found in last node of the leak trace'); |
{ | ||
"name": "@memlab/core", | ||
"version": "1.1.14", | ||
"version": "1.1.16", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "memlab core libraries", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
551230
127
14248