Created
February 13, 2017 01:31
-
-
Save psiphi75/99ac5f583b9e09b0c51df4f087c8eca3 to your computer and use it in GitHub Desktop.
Create a CPU profile using Node.js and v8-profiler
This file contains 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 profiler = require('v8-profiler'); | |
var fs = require('fs'); | |
var processStartTime = new Date().getTime(); | |
profiler.startProfiling(); | |
while (true) { | |
rt.renderFrame(done); | |
if (new Date().getTime() - processStartTime > 60000) { | |
console.log(`frames,${frames}`); | |
profiler.stopProfiling().export(function(error, result) { | |
fs.writeFileSync('profile.cpuprofile', result); | |
process.exit(); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment