Skip to content

Commit

Permalink
print debug duration
Browse files Browse the repository at this point in the history
  • Loading branch information
zardoy committed Dec 18, 2024
1 parent 064d704 commit 51c1346
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/topRightStats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 51c1346

Please sign in to comment.