Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

event-loop-lag

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

event-loop-lag

Measure event loop lag

  • 1.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
26K
decreased by-0.02%
Maintainers
2
Weekly downloads
 
Created
Source

#event-loop-lag

Measures Node.js event loop lag.

Build Status Coverage Status npm

var interval = 1000; // how often to refresh our measurement
var lag = require('event-loop-lag')(interval);

console.log('event loop lag is %d', lag());
event-loop-lag(number)

event-loop-lag accepts a number of milliseconds representing how often to refresh the event loop lag measurement and returns a function you can call to receive the latest lag measurement in milliseconds.

var lag = require('event-loop-lag')(1000);
var koa = require('koa');
var app = koa();

app.use(function*(next){
  if ('/lag' == this.url)
    this.body = lag() + ' milliseconds';
  else
    yield next;
})

Installation

npm install event-loop-lag --save

Development

running tests
  • make test runs tests
  • make test-cov runs tests + test coverage
  • make open-cov opens test coverage results in your browser
verbose logging

event-loop-lag supports the debug module for help during development. Enable verbose logging by setting your DEBUG env variable like so:

DEBUG=event-loop-lag* npm test

Sponsored by

Pebble Technology!

License

MIT

FAQs

Package last updated on 25 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc