0.0.5 • Published 9 years ago

block-event v0.0.5

Weekly downloads
15
License
ISC
Repository
github
Last release
9 years ago

block-event

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.

Installation

$ npm install block-event

How to use

Set up watch

var threshold = 10;  //ms
var BlockEvent = require('block-event');
var blockEvent = new BlockEvent(threshold);

blockEvent.threshold === 10; // true


blockEvent.on('blocked',function(lagtime){
    console.log("Your eventloop blocked for:"+lagtime+" ms");
});

To stop the watcher, use stop(). It emits a watchStopped event.

blockEvent.stop();

To resume the watcher use resume(). It emits a watchStarted event.

blockEvent.resume();

To get the average cicyle time use avg():

var avg = blockEvent.avg();

To get the maximum cicyle time use max():

var max = blockEvent.max();

The default lag threshold is 10 ms.

Test

$ npm test
0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago