Trigger CPU profile recording or heap snapshots for node apps using keyboard shortcuts.
Taking a heap snapshot
- Start v8-profiler-trigger-electron once in your app
const v8ProfilerTrigger = require('v8-profiler-trigger-electron');
v8ProfilerTrigger();
- Press
h
followed by enter - Thats it, you can now load the saved .heapsnapshot to Chrome debugger
In debugger, open Profiles
tab. Click Load and
open the .heapsnapshot.
npm install v8-profiler-trigger-electron --save-dev
Starts the V8 profiler trigger listeners.
{
// Trigger snapshots or recording via stdin events.
// The only method supported currently is 'stdin'.
listenMethod: 'stdin',
// Changes default CPU profiler sampling interval to the specified
// number of microseconds. Default interval is 1000us.
samplingInterval: 1000
}
Examples how to use the v8-profiler.
You can use Chrome debugger to interactively inspect results:
MIT