n3dst4 / stopwatch

Lightweight stopwatch for ad-hoc timings in JS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

stopwatch.js

Lightweight stopwatch for ad-hoc timings in JS.

Usage:

stopwatch.start(label); // start timing label stopwatch.stop(label); // stop timing label stopwatch.report(); // return a string showing timed labels stopwatch.reset(); // clear all labels

Example:

stopwatch.start("Long difficult task"); stopwatch.start("Particular subtask"); stopwatch.sop("Particular subtask"); stopwatch.stop("Long difficult task"); alert(stopwatch.report());

Notes

You can start() and stop() any number of labels. They are all tracked independently.

Tests

Run node test-server.js to fire up a simple webserver and load the tests in your browser.

About

Lightweight stopwatch for ad-hoc timings in JS


Languages

Language:JavaScript 89.1%Language:HTML 10.9%