loo

loopbench

Benchmark your event loop

Showing:

Popularity

Downloads/wk

9.6K

GitHub Stars

76

Maintenance

Last Commit

6yrs ago

Contributors

1

Package

Dependencies

1

Size (min+gzip)

0.5KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Readme

loopbench

Build Status

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([opts])

Creates a new instance of loopbench.

Options:

  • sampleInterval: the interval at which the eventLoop should be sampled, defaults to 5.
  • limit: the maximum amount of delay that is tollerated before overLimit becomes true, and the load event is emitted, defaults to 42.

Events:

  • load, emitted when instance.delay > instance.limit
  • unload, emitted when overLimit goes from true and false

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, Licensed under MIT.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100