Skip to content

Trigger CPU profile recording or heap snapshots for node apps using keyboard shortcuts.

License

Notifications You must be signed in to change notification settings

popul/v8-profiler-trigger-electron

 
 

Repository files navigation

v8-profiler-trigger-electron

Trigger CPU profile recording or heap snapshots for node apps using keyboard shortcuts.

NPM Badge

Taking a heap snapshot

Demo

  1. Start v8-profiler-trigger-electron once in your app
const v8ProfilerTrigger = require('v8-profiler-trigger-electron');
v8ProfilerTrigger();
  1. Press h followed by enter
  2. Thats it, you can now load the saved .heapsnapshot to Chrome debugger

In debugger, open Profiles tab. Click Load and open the .heapsnapshot.

Install

npm install v8-profiler-trigger-electron --save-dev

API

v8ProfilerTrigger([opts])

Starts the V8 profiler trigger listeners.

opts

{
  // 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
}

Usage

Examples how to use the v8-profiler.

CPU Profiling

You can use Chrome debugger to interactively inspect results:

Flamegraph

License

MIT

About

Trigger CPU profile recording or heap snapshots for node apps using keyboard shortcuts.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%