var timer = new Class({ options: { pause: 0 }, Implements: [Options,Events], initialize: function(options) { this.setOptions(options); this.counter = 0; }, startTest: function(fn, runs, label) { this.start = new Date(); var runs = runs || 1; while(runs--) { fn.apply(this); } this.end = new Date(); this.timeElapsed = this.end.getTime() - this.start.getTime(); this.counter++; this.label = label || "n/a"; this.fireEvent("complete", this); } });