类: ShapeUnboundGrowthAnalysis
层级结构
↳
ShapeUnboundGrowthAnalysis
构造函数
new ShapeUnboundGrowthAnalysis()
方法
analyzeSnapshotsInDirectory(directory
, options?
)
为一系列堆快照文件运行堆分析
- 参数:
directory
:string
| 包含一系列.heapsnapshot
文件的目录的绝对路径,所有快照文件将按照快照文件名称的字母数字升序加载和分析。options
:RunHeapAnalysisOptions
| 堆分析运行的可选配置
- 返回:
Promise
<AnalyzeSnapshotResult
>| 此 API 返回 AnalyzeSnapshotResult,其中包含分析控制台输出的日志文件。 或者,要获得更结构化的分析结果,请查看托管堆分析类的文档,并在调用此方法后调用特定于分析的 API 以获取结果。 - 示例:
const analysis = new ShapeUnboundGrowthAnalysis();
// analysis console output is saved in result.analysisOutputFile
const result = await analysis.analyzeSnapshotsInDirectory(snapshotDirectory);
// query analysis-specific and structured results
const shapes = analysis.getShapesWithUnboundGrowth();
- 此外,您可以指定一个工作目录,用于存储中间文件、日志文件和最终输出文件
const analysis = new ShapeUnboundGrowthAnalysis();
// analysis console output is saved in result.analysisOutputFile
// which is inside the specified working directory
const result = await analysis.analyzeSnapshotsInDirectory(snapshotDirectory, {
// if the specified directory doesn't exist, memlab will create it
workDir: '/tmp/your/work/dir',
});
getCommandName()
获取堆分析的名称,该名称也用于在 memlab 命令行工具中引用分析。
以下终端命令将使用此分析启动: memlab analyze <ANALYSIS_NAME>
- 返回:
string
| 分析的名称 - 示例:
const analysis = new YourAnalysis();
const name = analysis.getCommandName();
getShapesWithUnboundGrowth()
- 返回:
ShapeSummary
[] - 来源: