Skip to content

Instantly share code, notes, and snippets.

@Joris-van-der-Wel
Last active October 27, 2021 04:03
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Joris-van-der-Wel/4705395c018f12053968 to your computer and use it in GitHub Desktop.
Save Joris-van-der-Wel/4705395c018f12053968 to your computer and use it in GitHub Desktop.
node.js profiling: generate .cpuprofile which can be opened in chrome dev tools (F12)
'use strict';
var profiler = require('v8-profiler');
profiler.startProfiling();
// ...
var cpuProfile = profiler.stopProfiling();
require('fs').writeFileSync(__dirname + '/foo.cpuprofile', JSON.stringify(cpuProfile));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment