v8.startCpuProfile([options])


  • options <Object>
    • sampleInterval <number> 请求的采样间隔(毫秒)。默认值: 0
    • maxBufferSize <integer> 在丢弃旧条目之前要保留的最大样本数量。默认值: 4294967295
  • 返回:SyncCPUProfileHandle

启动 CPU 分析,然后返回一个 SyncCPUProfileHandle 对象。此 API 支持 using 语法。

🌐 Starting a CPU profile then return a SyncCPUProfileHandle object. This API supports using syntax.

const handle = v8.startCpuProfile({ sampleInterval: 1, maxBufferSize: 10_000 });
const profile = handle.stop();
console.log(profile);