诊所.js Heap 剖析器
可编程接口到 诊所.js 平面剖面仪. 更多关于诊所的知识 https://clinicjs.org/ (中文(简体) )

问题
打开一个问题,请使用 主要仓库 与 heapprofiler 标签.
安装
npm i -S @clinic/heap-profiler
支持的节点版本
- 16及以上节点j
示例
const ClinicHeapProfiler = require('@clinic/heap-profiler')
const heapProfiler = new ClinicHeapProfiler()
heapProfiler.collect(['node', './path-to-script.js'], function (err, filepath) {
if (err) throw err
heapProfiler.visualize(filepath, filepath + '.html', function (err) {
if (err) throw err
})
})
文档
const ClinicHeapProfiler = require('@clinic/heap-profiler')
const heapProfiler = new ClinicHeapProfiler()
新建 ClinicHeap 预览器( [设置])
- 设置
<Object>
heapProfiler.collect(args, callback)
通过使用 @ nearform/ hiap- profile。 。 。 .
过程采样工作一开始就立即开始. 所收集数据的文件路径将是回调值 .
stdout, (中文(简体) ), stderr,以及 stdin 将转发到呼叫程序.
采样在过程退出前被停止并收集数据.
如果想要更早收集数据,可以发送进程 a SIGINT 或,如果 detectPort 实值 true你可以打电话 heapProfiler.stopViaIPC()。 。 。 .
heapProfiler.visualize(dataFilename, outputFilename, callback)
将消耗由 dataFilename,此数据文件将是
采样者使用 heapProfiler.collect。 。 。 .
heapProfiler.visualize 然后输出一个独立的 HTML 文件到 outputFilename。 。 。 .
完成后 callback 将被调用,除了一个
可能的错误.
heapProfiler.stopViaIPC()
当配置器以 detectPort=true,剖析器建立了基于TCP的IPC通信.
因此,可以在任何时候使用这种方法来收集数据.
如果没有打开或可用的 TCP 频道, 该方法将不进行操作, 因此它可以安全地随时拨打 .
实例
见 examples 文件夹。 所有示例应在主文件夹中运行:
node examples/redis-web-service
每个 index.js 将包含示例所要求的任何具体设置步骤.