Skip to content

Latest commit

 

History

History
49 lines (34 loc) · 675 Bytes

Readme.md

File metadata and controls

49 lines (34 loc) · 675 Bytes

Histogram

Ansi histograms for nodejs.

Installation

$ npm install jstrace/histogram

Example

var request = require('superagent');
var histo = require('histogram');
var clear = require('clear');
var Batch = require('batch');

var batch = new Batch;
var data = [];

batch.concurrency(20);

for (var i = 0; i < 200; i++) {
  batch.push(function(done){
    process.stdout.write('.');
    var start = new Date;
    request.get('https://segment.io', function(){
      var delta = new Date - start;
      data.push(delta);
      done();
    });
  });
}

batch.end(done);

function done() {
  clear();
  console.log(histo(data));
}

License

MIT