1.1.1 • Published 12 years ago

puncher v1.1.1

Weekly downloads
55
License
-
Repository
github
Last release
12 years ago

Puncher

Build Status

Library to collect timing data for your node.js application. Simplifies bottlenecks search.

  1. Easy interface.
  2. Nesting support with coverage info.

See API documentation and example.

Usage overview

// require Puncher library
var Puncher = require('puncher');


// start profiler
var p = new Puncher();


p.start('Total');
setTimeout(function () {

  p.start('Block 1');
  setTimeout(function () {
    p.stop(); // Stop Block 1

    p.start('Block 2');
    setTimeout(function () {
      p.stop(); // Stop Block 2

      p.stop(); // Stop Total
      console.log(require('util').inspect(p.result, false, 10, true));
    }, 300);
  }, 200);
}, 100);

Example above will show you something like this:

[ { message: 'Total',
    start: 1342643670524,
    stop: 1342643671130,
    elapsed: { total: 606, missed: 105 },
    meta: {},
    childs: 
     [ { message: 'Block 1',
         start: 1342643670629,
         stop: 1342643670829,
         elapsed: { total: 200, missed: 0 },
         meta: {},
         childs: [] },
       { message: 'Block 2',
         start: 1342643670829,
         stop: 1342643671130,
         elapsed: { total: 301, missed: 0 },
         meta: {},
         childs: [] } ] } ]