diff options
-rw-r--r-- | src/proxyClient.js | 2 | ||||
-rw-r--r-- | src/webGLWorker.js | 13 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/proxyClient.js b/src/proxyClient.js index 90949673..94d8161a 100644 --- a/src/proxyClient.js +++ b/src/proxyClient.js @@ -32,7 +32,7 @@ window.requestAnimationFrame = function(func) { if (lastRAF > 0) { var diff = now - lastRAF; var fps = 1000/diff; - meanFPS = 0.99*meanFPS + 0.1*fps; + meanFPS = 0.95*meanFPS + 0.05*fps; dump('client fps ' + meanFPS + '\n'); } lastRAF = now; diff --git a/src/webGLWorker.js b/src/webGLWorker.js index 5fc69bd3..4c221be0 100644 --- a/src/webGLWorker.js +++ b/src/webGLWorker.js @@ -848,8 +848,19 @@ function WebGLWorker() { // Setup var dropped = 0; var average = 0; + var last = 0; + var meanDiff = 0; var preMainLoop = Module['preMainLoop']; Module['preMainLoop'] = function() { + /* + var now = Date.now(); + if (last > 0) { + var diff = now - last; + meanDiff = 0.95*meanDiff + 0.05*diff; + if (clientFrameId % 10 === 0) dump('server fps ' + (1000/meanDiff) + ' (ignoring client throttling)\n'); + } + last = now; + */ if (preMainLoop) { var ret = preMainLoop(); if (ret === false) return ret; @@ -857,7 +868,7 @@ function WebGLWorker() { // if too many frames in queue, skip a main loop iter if (Math.abs(frameId - clientFrameId) >= 3) { //dropped++; - //if (dropped % 1000 === 0) dump('dropped: ' + [dropped, frameId, Math.round(100*dropped/frameId) + '%\n']); + //if (dropped % 10 === 0) dump('dropped: ' + [dropped, frameId, Math.round(100*dropped/(frameId + dropped)) + '%\n']); return false; } }; |