Awesome
loopbench
Benchmark your event loop, extracted from hapi, hoek, heavy and boom.
<a name="install"></a>
Install
To install loopbench, simply use npm:
npm i loopbench --save
<a name="example"></a>
Example
See example.js.
<a name="api"></a>
API
- <a href="#constructor"><code><b>loopbench()</b></code></a>
- <a href="#delay"><code>instance.<b>delay</b></code></a>
- <a href="#limit"><code>instance.<b>limit</b></code></a>
- <a href="#overLimit"><code>instance.<b>overLimit</b></code></a>
- <a href="#stop"><code>instance.<b>stop()</b></code></a>
<a name="constructor"></a>
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
<a name="delay"></a>
instance.delay
The delay in milliseconds (and fractions) from the expected run. It might be negative (in older nodes).
<a name="limit"></a>
instance.limit
The maximum amount of delay that is tollerated before
overLimit
becomes true, and the load
event is
emitted.
<a name="overLimit"></a>
instance.overLimit
Is true
if the instance.delay > instance.limit
.
<a name="stop"></a>
instance.stop()
Stops the sampling.
<a name="license"></a>
License
Copyright Matteo Collina 2015-2022, Licensed under MIT.