Skip to content

Instantly share code, notes, and snippets.

@shanselman shanselman/dumpme
Created Mar 28, 2017

Embed
What would you like to do?
app.get('/dumpme', function (req, res) {
var fs = require('fs'),
ws = fs.createWriteStream('debugdump/'+Date.now() + '.heapsnapshot'),
profiler = require('v8-profiler'),
snapshot = profiler.takeSnapshot(),
callback = ws.end.bind(ws);
snapshot.serialize(function(data) {
ws.write('' + data);
}, callback);//begin cpu profiling
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.