Skip to content

Commit

Permalink
fix to average fps calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnLunsford committed Dec 13, 2023
1 parent ae4dcf0 commit 3463b0d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions devtools/web/src/devtools-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand All @@ -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,
Expand Down

0 comments on commit 3463b0d

Please sign in to comment.