/*  $Id: benchmark_firebug.js,v 1.4 2007/09/05 01:04:50 altblue Exp $
    (c) 2006-2007 Marius Feraru <altblue@n0i.net>

    This module is free software; you can redistribute it
    and/or modify it under the same terms as Perl itself.

    For details, check http://gfx.neohub.com/benchmark/
*/

Benchmark.Responders.Firebug = {
  NAME:     'Benchmark.Responders.Firebug',
  VERSION:  '0.2.0',
  REVISION: '$Revision: 1.4 $'.replace(/^[^ ]+ (.+?) \$$/,'$1'),
  toString: Benchmark.toString,

  onInit: function() {
    console.debug('Running %s: %o', this.title || 'benchmark', this);
  },

  onFinish: function(m) {
    var c = this.data[m], secs = c.duration / 1000;
    if (secs > 0)
      console.debug('%s: %f seconds at %f/s (avg: %f, worst: %f, best: %f)',
        c.name, secs, c.rate.toFixed(3), c.avg.toFixed(3), c.worst.toFixed(3), c.best.toFixed(3));
    else
      console.debug('%s: Too few iterations for a reliable count!', c.name);
  },

  onComplete: function() {
    console.debug('benchmark completed. full results: %o', this.data);
  }

};
