From 51c1346456102ef660ca7e107e04c03667d45b47 Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Wed, 18 Dec 2024 09:20:59 +0300 Subject: [PATCH] print debug duration --- src/topRightStats.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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)