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

node-tictoc

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-tictoc

Simple stopwatch timer for profiling operations

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

tictoc

npm install node-tictoc

Wrapper around process.hrtime that lets you have a stack of timers with a simpler api and more useful output:

Usage

  var time = require('node-tictoc');

  time.tic();

  for(var i = 0; i < 1000; i++) {
    // do something
  }

  time.toc(); // prints the elapsed seconds and/or milliseconds

Or a recursive timing solution that takes advantage of the stack:

  function foo(n) {
    if (! n) return;

    time.tic();

    foo(n - 1);

    time.toc(); // prints the elapsed time in last-in-first-out (LIFO) order
  }

If you just want the time values:

  time.toct()

Returns an object with the following values for the most recent timer (started with tic):

  • seconds
  • nanos
  • ms

Keywords

FAQs

Package last updated on 24 Jul 2014

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