——从入门到玄学大师
P.S. node -e "process._debugProcess(PID)" for node process
P.S. 使用 command + p 切换文件
e.g. python/c#/cpp/ts/coffee ...
1. launch program directly
2. Attach by Process ID
3. Remote debugging
1.performance
2.network
2.network
const http = require('http')
const port = 3000
const server = http.createServer(function(request, response) {
response.setHeader('Server-Timing', `cache=2; "Cache Read", db=1; "Database Read", process=1.5; "Process Request"`)
response.end('Hello Core!')
})
server.listen(port, function() {
console.log(`Listening on http://localhost:${port}`)
})
3.1 Memory Summary
3.2 Profile allocation
3.3 Live chart
3.4 Other Tools
chrome://about
dns
net-internal
tracing
在这个界面按6下 shift 可以出现隐藏功能
chrome 61 改了输出格式,所以市面上暂时没什么工具可以解析
否则可以用oneprofile这类文件可视化函数 call stack 同时显示 v8 deopz 原因,不过下一个版本 node 都换v8 引擎了,又有大批deopz的原因可以不用记了
// ui debug only
// chrome only
setTimeout(function() {
debugger
}, 10000)