-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(heap-analysis) support loading external analysis plugin
Summary: ``` memlab analyze <external-analysis-name> --analysis-plugin <external-analysis-plugin-file> --snapshot <snapshot-file> ``` Differential Revision: D52937130 fbshipit-source-id: 456def2ef5543a523dd72427ca8c5ffb417fad24
- Loading branch information
1 parent
0e5e89b
commit 2475ed1
Showing
5 changed files
with
135 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @format | ||
* @oncall web_perf_infra | ||
*/ | ||
|
||
import type {ParsedArgs} from 'minimist'; | ||
import {AnyRecord, MemLabConfig} from '@memlab/core'; | ||
import {BaseOption} from '@memlab/core'; | ||
import optionConstants from '../lib/OptionConstant'; | ||
|
||
export default class HeapAnalysisPluginOption extends BaseOption { | ||
getOptionName(): string { | ||
return optionConstants.optionNames.HEAP_ANALYSIS_PLUGIN_FILE; | ||
} | ||
|
||
getDescription(): string { | ||
return ( | ||
'specify the external heap analysis plugin file ' + | ||
'(must be a vanilla JS file ended with `Analysis.js` suffix)' | ||
); | ||
} | ||
|
||
async parse( | ||
config: MemLabConfig, | ||
args: ParsedArgs, | ||
): Promise<{workDir?: string}> { | ||
const name = this.getOptionName(); | ||
const ret: AnyRecord = {}; | ||
const heapAnalysisPlugin = args[name]; | ||
if (heapAnalysisPlugin) { | ||
ret.heapAnalysisPlugin = heapAnalysisPlugin; | ||
} | ||
return ret; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters