Last active
February 27, 2020 22:56
-
-
Save cvan/d5127262cb6873aa93eecdae3bdee9e3 to your computer and use it in GitHub Desktop.
monitor Node.js event-loop delays (requires Node.js v11+)
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
// Source: https://twitter.com/jasnell/status/1233135311959445504 | |
// | |
// PSA: Did you know that since Node.js 11.0.0 there's been a built-in mechanism for monitoring event loop delay? | |
const { monitorEventLoopDelay } = require('perf_hooks'); | |
const h = monitorEventLoopDelay({ resolution: 20 }); | |
h.enable(); | |
// Do something. | |
h.disable(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment