Skip to content

Commit

Permalink
Make benchmark results available from outside
Browse files Browse the repository at this point in the history
  • Loading branch information
phoboslab committed Nov 4, 2014
1 parent 32f8c17 commit a181ced
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions jsmpg.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ jsmpeg.prototype.targetTime = 0;
jsmpeg.prototype.benchmark = false;
jsmpeg.prototype.benchFrame = 0;
jsmpeg.prototype.benchDecodeTimes = 0;
jsmpeg.prototype.benchAvgFrameTime = 0;

jsmpeg.prototype.now = function() {
return window.performance
Expand Down Expand Up @@ -466,10 +467,10 @@ jsmpeg.prototype.scheduleNextFrame = function() {
if( this.benchmark ) {
this.benchFrame++;
if( this.benchFrame >= 120 ) {
var frameTime = this.benchDecodeTimes / this.benchFrame;
console.log("Average time per frame:", frameTime, 'ms');
this.benchAvgFrameTime = this.benchDecodeTimes / this.benchFrame;
this.benchFrame = 0;
this.benchDecodeTimes = 0;
if( window.console ) { console.log("Average time per frame:", this.benchAvgFrameTime, 'ms'); }
}
setTimeout( this.nextFrame.bind(this), 0);
}
Expand Down

0 comments on commit a181ced

Please sign in to comment.