shfshanyue / Daily-Question

互联网大厂内推及大厂面经整理,并且每天一道面试题推送。每天五分钟,半年大厂中
https://q.shanyue.tech
4.88k stars 504 forks source link

【Q698】有没有使用过 Node 的 inspect 这个核心模块 #720

Open shfshanyue opened 2 years ago

shfshanyue commented 2 years ago

文档:Node Inspector API

const inspector = require('inspector');
shfshanyue commented 2 years ago
  const session = new inspector.Session()
  session.connect()
  session.post('Profiler.enable', () => {
    session.post('Profiler.start', start)
  })
iceycc commented 2 years ago

inspector 模块提供了与 V8 检查器交互的 API。