diff --git a/src/topRightStats.ts b/src/topRightStats.ts index fd717ef48..529aa9647 100644 --- a/src/topRightStats.ts +++ b/src/topRightStats.ts @@ -114,14 +114,16 @@ const updateStatsPerSecAvg = () => { window.statsPerSec = {} let statsPerSecCurrent = {} +let lastReset = performance.now() window.addStatPerSec = (name) => { statsPerSecCurrent[name] ??= 0 statsPerSecCurrent[name]++ } window.statsPerSecCurrent = statsPerSecCurrent setInterval(() => { - window.statsPerSec = statsPerSecCurrent + window.statsPerSec = { duration: Math.floor(performance.now() - lastReset), ...statsPerSecCurrent, } statsPerSecCurrent = {} window.statsPerSecCurrent = statsPerSecCurrent updateStatsPerSecAvg() + lastReset = performance.now() }, 1000)