Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mcollina/loopbench
Benchmark your event loop
https://github.com/mcollina/loopbench
Last synced: 14 days ago
JSON representation
Benchmark your event loop
- Host: GitHub
- URL: https://github.com/mcollina/loopbench
- Owner: mcollina
- License: mit
- Created: 2015-11-10T20:29:16.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2023-05-31T09:10:46.000Z (over 1 year ago)
- Last Synced: 2024-10-24T23:15:07.139Z (20 days ago)
- Language: JavaScript
- Size: 14.6 KB
- Stars: 109
- Watchers: 3
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# loopbench
Benchmark your event loop, extracted from [hapi](http://npm.im/hapi),
[hoek](http://npm.im/hoek), [heavy](http://npm.im/heavy) and
[boom](http://npm.im/boom).* [Install](#install)
* [Example](#example)
* [API](#api)
* [Acknowledgements](#acknowledgements)
* [License](#license)
## Install
To install loopbench, simply use npm:```
npm i loopbench --save
```See [example.js][example].
*
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 to `5`.
* `limit`: the maximum amount of delay that is tollerated before
[`overLimit`](#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.delayThe delay in milliseconds (and fractions) from the expected run.
It might be negative (in older nodes).-------------------------------------------------------
### instance.limitThe maximum amount of delay that is tollerated before
[`overLimit`](#overlimit) becomes true, and the `load` event is
emitted.-------------------------------------------------------
### instance.overLimitIs `true` if the `instance.delay > instance.limit`.
-------------------------------------------------------
### instance.stop()Stops the sampling.
Copyright Matteo Collina 2015-2022, Licensed under [MIT][].
[MIT]: ./LICENSE
[example]: ./example.js