Socket
Socket
Sign inDemoInstall

measure

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

measure

Measure the duration of JS code segments and keep stats


Version published
Weekly downloads
179
decreased by-14.35%
Maintainers
1
Weekly downloads
 
Created
Source

This simple module mesures the duration of javascript operations. The module itself is an instance of EventEmitter2.

Example

var measure = require('measure');
var done = measure.measure('timeconsuming.operation');

measure.on('timeconsuming.*', function(duration) {
  console.log(duration); // same value as returned from done()
});

setTimeout(function() {
  var duration = done();
  console.log(duration); // ~1000 
}, 1000);

API

measure(key)

Start the measurement using the string key Returns a function to be called when the measurement is complete.

stats([key])

Return the statistics for the given key or statistics for all keys if none is given.

clear([key])

Clear stats for the given key or all keys if none is given.

Install

npm install measure

Run Tests

mocha tests/measure.test.js --reporter spec

License

MIT/X11

FAQs

Package last updated on 25 Feb 2012

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