diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-06-20 11:18:49 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-06-20 11:18:49 -0700 |
commit | 93a8c32dbab96f01d2b6a5fb5a4ad35c3529beb1 (patch) | |
tree | a1c28496c4817ab7be45cffa58e840665ec17cca | |
parent | c6e416fcd10d2b9a42c3d77988b822682961b94f (diff) |
fps debugging stuff
-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; } }; |