@memlab/cli 1.0.21 → 1.0.23
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/dist/commands/heap/CheckLeakCommand.d.ts +2 -3
- package/dist/commands/heap/CheckLeakCommand.js +12 -2
- package/dist/commands/heap/DiffLeakCommand.d.ts +21 -0
- package/dist/commands/heap/DiffLeakCommand.js +110 -0
- package/dist/commands/heap/interactive/InteractiveHeapExploreCommand.js +3 -0
- package/dist/commands/heap/interactive/ui-components/ListComponent.js +0 -1
- package/dist/commands/snapshot/TakeSnapshotCommand.js +2 -0
- package/dist/options/SetWorkingDirectoryOption.d.ts +1 -1
- package/dist/options/SetWorkingDirectoryOption.js +3 -2
- package/dist/options/e2e/TargetWorkerOption.d.ts +19 -0
- package/dist/options/e2e/TargetWorkerOption.js +51 -0
- package/dist/options/experiment/SetControlWorkDirOption.d.ts +20 -0
- package/dist/options/experiment/SetControlWorkDirOption.js +44 -0
- package/dist/options/experiment/SetTreatmentWorkDirOption.d.ts +20 -0
- package/dist/options/experiment/SetTreatmentWorkDirOption.js +44 -0
- package/dist/options/heap/CleanupSnapshotOption.d.ts +19 -0
- package/dist/options/heap/CleanupSnapshotOption.js +42 -0
- package/dist/options/lib/OptionConstant.d.ts +8 -0
- package/dist/options/lib/OptionConstant.js +4 -0
- package/package.json +1 -1
|
@@ -7,15 +7,14 @@
|
|
|
7
7
|
* @format
|
|
8
8
|
* @oncall web_perf_infra
|
|
9
9
|
*/
|
|
10
|
-
import type { CLIOptions } from '@memlab/core';
|
|
10
|
+
import type { BaseOption, CLIOptions } from '@memlab/core';
|
|
11
11
|
import BaseCommand, { CommandCategory } from '../../BaseCommand';
|
|
12
|
-
import { BaseOption } from '@memlab/core';
|
|
13
12
|
export default class CheckLeakCommand extends BaseCommand {
|
|
14
13
|
getCommandName(): string;
|
|
15
14
|
getDescription(): string;
|
|
16
15
|
getCategory(): CommandCategory;
|
|
17
16
|
getPrerequisites(): BaseCommand[];
|
|
18
17
|
getOptions(): BaseOption[];
|
|
19
|
-
run(
|
|
18
|
+
run(options: CLIOptions): Promise<void>;
|
|
20
19
|
}
|
|
21
20
|
//# sourceMappingURL=CheckLeakCommand.d.ts.map
|
|
@@ -61,6 +61,8 @@ const LeakClusterSizeThresholdOption_1 = __importDefault(require("../../options/
|
|
|
61
61
|
const MLClusteringOption_1 = __importDefault(require("../../options/MLClusteringOption"));
|
|
62
62
|
const MLClusteringLinkageMaxDistanceOption_1 = __importDefault(require("../../options/MLClusteringLinkageMaxDistanceOption"));
|
|
63
63
|
const MLClusteringMaxDFOption_1 = __importDefault(require("../../options/MLClusteringMaxDFOption"));
|
|
64
|
+
const CleanupSnapshotOption_1 = __importDefault(require("../../options/heap/CleanupSnapshotOption"));
|
|
65
|
+
const SetWorkingDirectoryOption_1 = __importDefault(require("../../options/SetWorkingDirectoryOption"));
|
|
64
66
|
class CheckLeakCommand extends BaseCommand_1.default {
|
|
65
67
|
getCommandName() {
|
|
66
68
|
return 'find-leaks';
|
|
@@ -89,13 +91,21 @@ class CheckLeakCommand extends BaseCommand_1.default {
|
|
|
89
91
|
new MLClusteringOption_1.default(),
|
|
90
92
|
new MLClusteringLinkageMaxDistanceOption_1.default(),
|
|
91
93
|
new MLClusteringMaxDFOption_1.default(),
|
|
94
|
+
new CleanupSnapshotOption_1.default(),
|
|
95
|
+
new SetWorkingDirectoryOption_1.default(),
|
|
92
96
|
];
|
|
93
97
|
}
|
|
94
|
-
|
|
95
|
-
|
|
98
|
+
run(options) {
|
|
99
|
+
var _a, _b;
|
|
96
100
|
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
const workDir = (_a = options.configFromOptions) === null || _a === void 0 ? void 0 : _a.workDir;
|
|
102
|
+
core_1.fileManager.initDirs(core_1.config, { workDir });
|
|
97
103
|
core_1.config.chaseWeakMapEdge = false;
|
|
98
104
|
yield core_1.analysis.checkLeak();
|
|
105
|
+
const configFromOptions = (_b = options.configFromOptions) !== null && _b !== void 0 ? _b : {};
|
|
106
|
+
if (configFromOptions['cleanUpSnapshot']) {
|
|
107
|
+
core_1.fileManager.removeSnapshotFiles();
|
|
108
|
+
}
|
|
99
109
|
});
|
|
100
110
|
}
|
|
101
111
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall web_perf_infra
|
|
9
|
+
*/
|
|
10
|
+
import { CLIOptions } from '@memlab/core';
|
|
11
|
+
import BaseCommand, { CommandCategory } from '../../BaseCommand';
|
|
12
|
+
import { BaseOption } from '@memlab/core';
|
|
13
|
+
export default class CheckLeakCommand extends BaseCommand {
|
|
14
|
+
getCommandName(): string;
|
|
15
|
+
getDescription(): string;
|
|
16
|
+
getCategory(): CommandCategory;
|
|
17
|
+
getPrerequisites(): BaseCommand[];
|
|
18
|
+
getOptions(): BaseOption[];
|
|
19
|
+
run(options: CLIOptions): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=DiffLeakCommand.d.ts.map
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
|
+
*/
|
|
11
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
+
}
|
|
17
|
+
Object.defineProperty(o, k2, desc);
|
|
18
|
+
}) : (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
21
|
+
}));
|
|
22
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
+
}) : function(o, v) {
|
|
25
|
+
o["default"] = v;
|
|
26
|
+
});
|
|
27
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
35
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
36
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
37
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
38
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
39
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
40
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
44
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
45
|
+
};
|
|
46
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
+
const core_1 = require("@memlab/core");
|
|
48
|
+
const core_2 = require("@memlab/core");
|
|
49
|
+
const BaseCommand_1 = __importStar(require("../../BaseCommand"));
|
|
50
|
+
const core_3 = require("@memlab/core");
|
|
51
|
+
const JSEngineOption_1 = __importDefault(require("../../options/heap/JSEngineOption"));
|
|
52
|
+
const InitDirectoryCommand_1 = __importDefault(require("../InitDirectoryCommand"));
|
|
53
|
+
const OversizeThresholdOption_1 = __importDefault(require("../../options/heap/OversizeThresholdOption"));
|
|
54
|
+
const TraceAllObjectsOption_1 = __importDefault(require("../../options/heap/TraceAllObjectsOption"));
|
|
55
|
+
const LogTraceAsClusterOption_1 = __importDefault(require("../../options/heap/LogTraceAsClusterOption"));
|
|
56
|
+
const CleanLoggerDataCommand_1 = __importDefault(require("../CleanLoggerDataCommand"));
|
|
57
|
+
const LeakFilterFileOption_1 = __importDefault(require("../../options/heap/leak-filter/LeakFilterFileOption"));
|
|
58
|
+
const LeakClusterSizeThresholdOption_1 = __importDefault(require("../../options/heap/LeakClusterSizeThresholdOption"));
|
|
59
|
+
const MLClusteringOption_1 = __importDefault(require("../../options/MLClusteringOption"));
|
|
60
|
+
const MLClusteringLinkageMaxDistanceOption_1 = __importDefault(require("../../options/MLClusteringLinkageMaxDistanceOption"));
|
|
61
|
+
const MLClusteringMaxDFOption_1 = __importDefault(require("../../options/MLClusteringMaxDFOption"));
|
|
62
|
+
const SetControlWorkDirOption_1 = __importDefault(require("../../options/experiment/SetControlWorkDirOption"));
|
|
63
|
+
const SetTreatmentWorkDirOption_1 = __importDefault(require("../../options/experiment/SetTreatmentWorkDirOption"));
|
|
64
|
+
class CheckLeakCommand extends BaseCommand_1.default {
|
|
65
|
+
getCommandName() {
|
|
66
|
+
return 'diff-leaks';
|
|
67
|
+
}
|
|
68
|
+
getDescription() {
|
|
69
|
+
return 'find new memory leaks by diffing control and test heap snapshots';
|
|
70
|
+
}
|
|
71
|
+
getCategory() {
|
|
72
|
+
return BaseCommand_1.CommandCategory.COMMON;
|
|
73
|
+
}
|
|
74
|
+
getPrerequisites() {
|
|
75
|
+
return [new InitDirectoryCommand_1.default(), new CleanLoggerDataCommand_1.default()];
|
|
76
|
+
}
|
|
77
|
+
getOptions() {
|
|
78
|
+
return [
|
|
79
|
+
new SetControlWorkDirOption_1.default().required(),
|
|
80
|
+
new SetTreatmentWorkDirOption_1.default().required(),
|
|
81
|
+
new JSEngineOption_1.default(),
|
|
82
|
+
new LeakFilterFileOption_1.default(),
|
|
83
|
+
new OversizeThresholdOption_1.default(),
|
|
84
|
+
new LeakClusterSizeThresholdOption_1.default(),
|
|
85
|
+
new TraceAllObjectsOption_1.default(),
|
|
86
|
+
new LogTraceAsClusterOption_1.default(),
|
|
87
|
+
new MLClusteringOption_1.default(),
|
|
88
|
+
new MLClusteringLinkageMaxDistanceOption_1.default(),
|
|
89
|
+
new MLClusteringMaxDFOption_1.default(),
|
|
90
|
+
];
|
|
91
|
+
}
|
|
92
|
+
run(options) {
|
|
93
|
+
var _a, _b;
|
|
94
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
+
core_3.config.chaseWeakMapEdge = false;
|
|
96
|
+
// double check parameters
|
|
97
|
+
if (!((_a = options.configFromOptions) === null || _a === void 0 ? void 0 : _a.controlWorkDir) ||
|
|
98
|
+
!((_b = options.configFromOptions) === null || _b === void 0 ? void 0 : _b.treatmentWorkDir)) {
|
|
99
|
+
core_2.info.error('Please specify control and test working directory');
|
|
100
|
+
throw core_1.utils.haltOrThrow('No control or test working directory specified');
|
|
101
|
+
}
|
|
102
|
+
// get parameters
|
|
103
|
+
const controlWorkDir = options.configFromOptions['controlWorkDir'];
|
|
104
|
+
const treatmentWorkDir = options.configFromOptions['treatmentWorkDir'];
|
|
105
|
+
// diff memory leaks
|
|
106
|
+
yield core_3.analysis.diffLeakByWorkDir({ controlWorkDir, treatmentWorkDir });
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
exports.default = CheckLeakCommand;
|
|
@@ -53,6 +53,7 @@ const JSEngineOption_1 = __importDefault(require("../../../options/heap/JSEngine
|
|
|
53
53
|
const CliScreen_1 = __importDefault(require("./ui-components/CliScreen"));
|
|
54
54
|
const HeapNodeIdOption_1 = __importDefault(require("../../../options/heap/HeapNodeIdOption"));
|
|
55
55
|
const MLClusteringOption_1 = __importDefault(require("../../../options/MLClusteringOption"));
|
|
56
|
+
const SetWorkingDirectoryOption_1 = __importDefault(require("../../../options/SetWorkingDirectoryOption"));
|
|
56
57
|
class InteractiveHeapViewCommand extends BaseCommand_1.default {
|
|
57
58
|
getCommandName() {
|
|
58
59
|
return 'view-heap';
|
|
@@ -72,6 +73,7 @@ class InteractiveHeapViewCommand extends BaseCommand_1.default {
|
|
|
72
73
|
new JSEngineOption_1.default(),
|
|
73
74
|
new HeapNodeIdOption_1.default(),
|
|
74
75
|
new MLClusteringOption_1.default(),
|
|
76
|
+
new SetWorkingDirectoryOption_1.default(),
|
|
75
77
|
];
|
|
76
78
|
}
|
|
77
79
|
// get the heap snapshot to view
|
|
@@ -160,6 +162,7 @@ class InteractiveHeapViewCommand extends BaseCommand_1.default {
|
|
|
160
162
|
var _a;
|
|
161
163
|
return __awaiter(this, void 0, void 0, function* () {
|
|
162
164
|
const workDir = (_a = options.configFromOptions) === null || _a === void 0 ? void 0 : _a.workDir;
|
|
165
|
+
core_1.fileManager.initDirs(core_1.config, { workDir, errorWhenAbsent: true });
|
|
163
166
|
const reportOutDir = core_1.fileManager.getReportOutDir({ workDir });
|
|
164
167
|
fs_extra_1.default.emptyDirSync(reportOutDir);
|
|
165
168
|
const heap = yield this.getHeap(options);
|
|
@@ -44,6 +44,7 @@ const SetUserAgentOption_1 = __importDefault(require("../../options/e2e/SetUserA
|
|
|
44
44
|
const DisableWebSecurityOption_1 = __importDefault(require("../../options/e2e/DisableWebSecurityOption"));
|
|
45
45
|
const EnableJSRewriteOption_1 = __importDefault(require("../../options/e2e/EnableJSRewriteOption"));
|
|
46
46
|
const EnableJSInterceptOption_1 = __importDefault(require("../../options/e2e/EnableJSInterceptOption"));
|
|
47
|
+
const TargetWorkerOption_1 = __importDefault(require("../../options/e2e/TargetWorkerOption"));
|
|
47
48
|
class TakeSnapshotCommand extends BaseCommand_1.default {
|
|
48
49
|
getCommandName() {
|
|
49
50
|
return 'snapshot';
|
|
@@ -85,6 +86,7 @@ class TakeSnapshotCommand extends BaseCommand_1.default {
|
|
|
85
86
|
new DisableWebSecurityOption_1.default(),
|
|
86
87
|
new EnableJSRewriteOption_1.default(),
|
|
87
88
|
new EnableJSInterceptOption_1.default(),
|
|
89
|
+
new TargetWorkerOption_1.default(),
|
|
88
90
|
];
|
|
89
91
|
}
|
|
90
92
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @oncall web_perf_infra
|
|
9
9
|
*/
|
|
10
10
|
import type { ParsedArgs } from 'minimist';
|
|
11
|
-
import
|
|
11
|
+
import { MemLabConfig } from '@memlab/core';
|
|
12
12
|
import { BaseOption } from '@memlab/core';
|
|
13
13
|
export default class SetWorkingDirectoryOption extends BaseOption {
|
|
14
14
|
getOptionName(): string;
|
|
@@ -34,8 +34,9 @@ class SetWorkingDirectoryOption extends core_1.BaseOption {
|
|
|
34
34
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35
35
|
const name = this.getOptionName();
|
|
36
36
|
const ret = {};
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
const workDir = args[name];
|
|
38
|
+
if (workDir) {
|
|
39
|
+
ret.workDir = workDir;
|
|
39
40
|
}
|
|
40
41
|
return ret;
|
|
41
42
|
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall web_perf_infra
|
|
9
|
+
*/
|
|
10
|
+
import type { ParsedArgs } from 'minimist';
|
|
11
|
+
import type { MemLabConfig } from '@memlab/core';
|
|
12
|
+
import { BaseOption } from '@memlab/core';
|
|
13
|
+
export default class TargetWorkerOption extends BaseOption {
|
|
14
|
+
getOptionName(): string;
|
|
15
|
+
getDescription(): string;
|
|
16
|
+
getExampleValues(): string[];
|
|
17
|
+
parse(config: MemLabConfig, args: ParsedArgs): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=TargetWorkerOption.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
|
+
*/
|
|
11
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
13
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
15
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
16
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
17
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
21
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
const core_1 = require("@memlab/core");
|
|
25
|
+
const OptionConstant_1 = __importDefault(require("../lib/OptionConstant"));
|
|
26
|
+
class TargetWorkerOption extends core_1.BaseOption {
|
|
27
|
+
getOptionName() {
|
|
28
|
+
return OptionConstant_1.default.optionNames.WORKER_TITLE;
|
|
29
|
+
}
|
|
30
|
+
getDescription() {
|
|
31
|
+
return ('set title of the target (worker) that ' +
|
|
32
|
+
'needs to be selected and analyzed');
|
|
33
|
+
}
|
|
34
|
+
getExampleValues() {
|
|
35
|
+
return ['WorkerTitle'];
|
|
36
|
+
}
|
|
37
|
+
parse(config, args) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const name = this.getOptionName();
|
|
40
|
+
const arg = args[name];
|
|
41
|
+
if (arg) {
|
|
42
|
+
config.isAnalyzingMainThread = false;
|
|
43
|
+
const value = Array.isArray(arg) ? arg[arg.length - 1] : arg;
|
|
44
|
+
if (typeof value === 'string') {
|
|
45
|
+
config.targetWorkerTitle = value;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.default = TargetWorkerOption;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall web_perf_infra
|
|
9
|
+
*/
|
|
10
|
+
import type { ParsedArgs } from 'minimist';
|
|
11
|
+
import type { MemLabConfig } from '@memlab/core';
|
|
12
|
+
import { BaseOption } from '@memlab/core';
|
|
13
|
+
export default class SetControlWorkDirOption extends BaseOption {
|
|
14
|
+
getOptionName(): string;
|
|
15
|
+
getDescription(): string;
|
|
16
|
+
parse(config: MemLabConfig, args: ParsedArgs): Promise<{
|
|
17
|
+
controlWorkDir?: string;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=SetControlWorkDirOption.d.ts.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
|
+
*/
|
|
11
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
13
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
15
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
16
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
17
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
21
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
const core_1 = require("@memlab/core");
|
|
25
|
+
const OptionConstant_1 = __importDefault(require("../lib/OptionConstant"));
|
|
26
|
+
class SetControlWorkDirOption extends core_1.BaseOption {
|
|
27
|
+
getOptionName() {
|
|
28
|
+
return OptionConstant_1.default.optionNames.CONTROL_WORK_DIR;
|
|
29
|
+
}
|
|
30
|
+
getDescription() {
|
|
31
|
+
return 'set the working directory of the control run';
|
|
32
|
+
}
|
|
33
|
+
parse(config, args) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const name = this.getOptionName();
|
|
36
|
+
const ret = {};
|
|
37
|
+
if (args[name]) {
|
|
38
|
+
ret.controlWorkDir = args[name];
|
|
39
|
+
}
|
|
40
|
+
return ret;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.default = SetControlWorkDirOption;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall web_perf_infra
|
|
9
|
+
*/
|
|
10
|
+
import type { ParsedArgs } from 'minimist';
|
|
11
|
+
import type { MemLabConfig } from '@memlab/core';
|
|
12
|
+
import { BaseOption } from '@memlab/core';
|
|
13
|
+
export default class SetTreatmentWorkDirOption extends BaseOption {
|
|
14
|
+
getOptionName(): string;
|
|
15
|
+
getDescription(): string;
|
|
16
|
+
parse(config: MemLabConfig, args: ParsedArgs): Promise<{
|
|
17
|
+
treatmentWorkDir?: string;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=SetTreatmentWorkDirOption.d.ts.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
|
+
*/
|
|
11
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
13
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
15
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
16
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
17
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
21
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
const core_1 = require("@memlab/core");
|
|
25
|
+
const OptionConstant_1 = __importDefault(require("../lib/OptionConstant"));
|
|
26
|
+
class SetTreatmentWorkDirOption extends core_1.BaseOption {
|
|
27
|
+
getOptionName() {
|
|
28
|
+
return OptionConstant_1.default.optionNames.TREATMENT_WORK_DIR;
|
|
29
|
+
}
|
|
30
|
+
getDescription() {
|
|
31
|
+
return 'set the working directory of the test (treatment) run';
|
|
32
|
+
}
|
|
33
|
+
parse(config, args) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const name = this.getOptionName();
|
|
36
|
+
const ret = {};
|
|
37
|
+
if (args[name]) {
|
|
38
|
+
ret.treatmentWorkDir = args[name];
|
|
39
|
+
}
|
|
40
|
+
return ret;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.default = SetTreatmentWorkDirOption;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall web_perf_infra
|
|
9
|
+
*/
|
|
10
|
+
import type { ParsedArgs } from 'minimist';
|
|
11
|
+
import { BaseOption, MemLabConfig } from '@memlab/core';
|
|
12
|
+
export default class CleanupSnapshotOption extends BaseOption {
|
|
13
|
+
getOptionName(): string;
|
|
14
|
+
getDescription(): string;
|
|
15
|
+
parse(config: MemLabConfig, args: ParsedArgs): Promise<{
|
|
16
|
+
cleanUpSnapshot: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=CleanupSnapshotOption.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
|
+
*/
|
|
11
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
13
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
15
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
16
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
17
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
21
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
const core_1 = require("@memlab/core");
|
|
25
|
+
const OptionConstant_1 = __importDefault(require("../lib/OptionConstant"));
|
|
26
|
+
class CleanupSnapshotOption extends core_1.BaseOption {
|
|
27
|
+
getOptionName() {
|
|
28
|
+
return OptionConstant_1.default.optionNames.CLEAN_UP_SNAPSHOT;
|
|
29
|
+
}
|
|
30
|
+
getDescription() {
|
|
31
|
+
return 'clean up heap snapshots after running';
|
|
32
|
+
}
|
|
33
|
+
parse(config, args) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const name = this.getOptionName();
|
|
36
|
+
return {
|
|
37
|
+
cleanUpSnapshot: !!args[name],
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.default = CleanupSnapshotOption;
|
|
@@ -11,7 +11,9 @@ declare const optionConstants: {
|
|
|
11
11
|
optionNames: {
|
|
12
12
|
APP: string;
|
|
13
13
|
BASELINE: string;
|
|
14
|
+
CLEAN_UP_SNAPSHOT: string;
|
|
14
15
|
CONTINUS_TEST: string;
|
|
16
|
+
CONTROL_WORK_DIR: string;
|
|
15
17
|
DEVICE: string;
|
|
16
18
|
DISABLE_WEB_SECURITY: string;
|
|
17
19
|
DISABLE_XVFB: string;
|
|
@@ -48,9 +50,11 @@ declare const optionConstants: {
|
|
|
48
50
|
TARGET: string;
|
|
49
51
|
TRACE_ALL_OBJECTS: string;
|
|
50
52
|
TRACE_OBJECT_SIZE_ABOVE: string;
|
|
53
|
+
TREATMENT_WORK_DIR: string;
|
|
51
54
|
USER_AGENT: string;
|
|
52
55
|
VERBOSE: string;
|
|
53
56
|
WORK_DIR: string;
|
|
57
|
+
WORKER_TITLE: string;
|
|
54
58
|
DEBUG: string;
|
|
55
59
|
};
|
|
56
60
|
optionShortcuts: {
|
|
@@ -64,7 +68,9 @@ declare const _default: {
|
|
|
64
68
|
optionNames: {
|
|
65
69
|
APP: string;
|
|
66
70
|
BASELINE: string;
|
|
71
|
+
CLEAN_UP_SNAPSHOT: string;
|
|
67
72
|
CONTINUS_TEST: string;
|
|
73
|
+
CONTROL_WORK_DIR: string;
|
|
68
74
|
DEVICE: string;
|
|
69
75
|
DISABLE_WEB_SECURITY: string;
|
|
70
76
|
DISABLE_XVFB: string;
|
|
@@ -101,9 +107,11 @@ declare const _default: {
|
|
|
101
107
|
TARGET: string;
|
|
102
108
|
TRACE_ALL_OBJECTS: string;
|
|
103
109
|
TRACE_OBJECT_SIZE_ABOVE: string;
|
|
110
|
+
TREATMENT_WORK_DIR: string;
|
|
104
111
|
USER_AGENT: string;
|
|
105
112
|
VERBOSE: string;
|
|
106
113
|
WORK_DIR: string;
|
|
114
|
+
WORKER_TITLE: string;
|
|
107
115
|
DEBUG: string;
|
|
108
116
|
};
|
|
109
117
|
optionShortcuts: {
|
|
@@ -13,7 +13,9 @@ const core_1 = require("@memlab/core");
|
|
|
13
13
|
const optionNames = {
|
|
14
14
|
APP: 'app',
|
|
15
15
|
BASELINE: 'baseline',
|
|
16
|
+
CLEAN_UP_SNAPSHOT: 'clean-up-snapshot',
|
|
16
17
|
CONTINUS_TEST: 'ContinuousTest',
|
|
18
|
+
CONTROL_WORK_DIR: 'control-work-dir',
|
|
17
19
|
DEVICE: 'device',
|
|
18
20
|
DISABLE_WEB_SECURITY: 'disable-web-security',
|
|
19
21
|
DISABLE_XVFB: 'disable-xvfb',
|
|
@@ -50,9 +52,11 @@ const optionNames = {
|
|
|
50
52
|
TARGET: 'target',
|
|
51
53
|
TRACE_ALL_OBJECTS: 'trace-all-objects',
|
|
52
54
|
TRACE_OBJECT_SIZE_ABOVE: 'trace-object-size-above',
|
|
55
|
+
TREATMENT_WORK_DIR: 'treatment-work-dir',
|
|
53
56
|
USER_AGENT: 'user-agent',
|
|
54
57
|
VERBOSE: 'verbose',
|
|
55
58
|
WORK_DIR: 'work-dir',
|
|
59
|
+
WORKER_TITLE: 'worker',
|
|
56
60
|
DEBUG: 'debug',
|
|
57
61
|
};
|
|
58
62
|
const optionShortcuts = {
|