Sample-based profiling estimates execution cost by interrupting a running program at regular intervals, recording its call stack, and resuming execution. Aggregated samples show where the program spent time: a function holding 25% of samples occupied the stack for roughly 25% of the recording. Because this is statistical measurement, it records neither every function call nor exact call counts. section 11.1.6
Interpret profiles according to the layer being measured:
- V8's --prof includes JavaScript execution, C++ runtime code, garbage collection, compilation, and shared libraries, then requires processing the raw log. section 11.1.6
- --cpu-prof produces a Chrome DevTools-compatible profile with JavaScript function names, source locations, and sample counts, but can omit or misattribute work outside the JavaScript call stack. section 11.1.6
Collecting a V8 profile
Run `node --prof server.js`, then process the resulting isolate log with `node --prof-process isolate-0x*.log` to obtain summary, bottom-up, and top-down reports. section 11.1.6
node --prof server.js
The command listing provides a directly runnable entry point for collecting a V8 tick-based profile. section 11.1.6

