Profiling a simple node application
suggest changeThe built-in inspector replaces the old node-inspector package and the --debug-brk flag. You do not install a separate profiler.
Step 1 : Start the script paused on the first line:
node --inspect-brk your/short/node/script.js
Step 2 : Node prints a DevTools URL and listens on 127.0.0.1:9229. Open chrome://inspect in Chrome, or open the printed URL. Execution is paused on the first line because of --inspect-brk. The old address http://127.0.0.1:8080/?port=5858 belonged to node-inspector. The screenshot below is that old UI.
Step 3 : Open the Profiler or Performance panel and start a recording. To profile one function, set a breakpoint just before it runs. Current DevTools uses these panels; the screenshot shows the old node-inspector UI.
Step 4 : After you record a CPU profile or a heap snapshot, read it in that window or save it.