Last active
October 27, 2021 04:03
-
-
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)
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
'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