From 3463b0d124b58a7a3957bf9a48861d12e0919c78 Mon Sep 17 00:00:00 2001 From: JohnLunsford <47752837+JohnLunsford@users.noreply.github.com> Date: Wed, 13 Dec 2023 13:14:04 -0500 Subject: [PATCH] fix to average fps calculation --- devtools/web/src/devtools-manager.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devtools/web/src/devtools-manager.ts b/devtools/web/src/devtools-manager.ts index b2a89bcd..ebb22ba8 100644 --- a/devtools/web/src/devtools-manager.ts +++ b/devtools/web/src/devtools-manager.ts @@ -65,7 +65,7 @@ export class DevtoolsManager { let sum = this._fpsBuffer[0]; for (let i = 1; i < 10; i++) sum += this._fpsBuffer[i]; - return sum / 10; + return Math.floor(sum / 10); } private _nextFPSBufferIdx = () => { (this._fpsBufferIdx == 9) ? this._fpsBufferIdx = 0 : this._fpsBufferIdx++; @@ -80,7 +80,7 @@ export class DevtoolsManager { deltaFrame: number ) => { if (this._enabled) { - this._fpsBuffer[this._nextFPSBufferIdx()] = Math.floor(1_000 / deltaFrame); + this._fpsBuffer[this._nextFPSBufferIdx()] = 1_000 / deltaFrame; this._bufferedData.update(runtimeInfo.data); this._notifyUpdateCompleted( runtimeInfo.data,