loopbench
v2.0.0
Published
Benchmark your event loop
Downloads
122,163
Readme
loopbench
Benchmark your event loop, extracted from hapi, hoek, heavy and boom.
Install
To install loopbench, simply use npm:
npm i loopbench --save
Example
See example.js.
API
- loopbench()
- instance.delay
- instance.limit
- instance.overLimit
- instance.stop()
loopbench([opts])
Creates a new instance of loopbench.
Options:
sampleInterval
: the interval at which the eventLoop should be sampled, defaults to5
.limit
: the maximum amount of delay that is tollerated beforeoverLimit
becomes true, and theload
event is emitted, defaults to42
.
Events:
load
, emitted wheninstance.delay > instance.limit
unload
, emitted whenoverLimit
goes fromtrue
andfalse
instance.delay
The delay in milliseconds (and fractions) from the expected run. It might be negative (in older nodes).
instance.limit
The maximum amount of delay that is tollerated before
overLimit
becomes true, and the load
event is
emitted.
instance.overLimit
Is true
if the instance.delay > instance.limit
.
instance.stop()
Stops the sampling.
License
Copyright Matteo Collina 2015-2022, Licensed under MIT.