Created
May 28, 2015 04:03
-
-
Save Unitech/f7e2110e7a0a2e3bfb22 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
| var fs = require('fs'); | |
| profiler.startProfiling('toto') | |
| setTimeout(function() { | |
| var cpu = profiler.stopProfiling('toto'); | |
| var snapshot = profiler.takeSnapshot('sisi'); | |
| var buffer = ''; | |
| snapshot.serialize( | |
| function iterator(data, length) { | |
| buffer += data; | |
| }, function complete() { | |
| var name = 'snap.heapsnapshot'; | |
| fs.writeFile(name , buffer, function () { | |
| console.log('Heap snapshot written to ' + name); | |
| }); | |
| } | |
| ); | |
| fs.writeFileSync('heap.cpuprofile', JSON.stringify(cpu)); | |
| console.log('worte'); | |
| }, 2000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment