Created
March 28, 2017 23:06
-
-
Save shanselman/22498257d12bab0906c1903a30edcd4c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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