Skip to content

Instantly share code, notes, and snippets.

View juliusza's full-sized avatar

Julius Žaromskis juliusza

View GitHub Profile
@juliusza
juliusza / process-monitor.js
Created December 22, 2017 15:00
node.js event loop delay monitor (measures max CPU time spent processing ticks)
const NS_PER_SEC = 1e9;
const NS_PER_MS = 1e6;
const SAMPLE_INTERVAL = 10;
class ProcessMonitor {
start(interval) {
let prevTime = [NaN, NaN];
this.maxEventLoopDelay = 0;
if (!interval) {