block-event is an event loop watcher for nodejs. It alerts you with a blocked event when the eventloop stopped more times then the given threshold.
$ npm install block-event
How to use
Set up watch
var threshold = 10; //msvar BlockEvent = ;var blockEvent = threshold;blockEventthreshold === 10; // trueblockEvent;
To stop the watcher, use stop(). It emits a watchStopped event.
To resume the watcher use resume(). It emits a watchStarted event.
To get the average cicyle time use avg():
var avg = blockEvent;
To get the maximum cicyle time use max():
var max = blockEvent;
The default lag threshold is 10 ms.
$ npm test