| 209 | } |
| 210 | |
| 211 | const syncFrame = (at: number) => { |
| 212 | trim(fps, span, at) |
| 213 | const total = fps.reduce((sum, entry) => sum + entry.dur, 0) |
| 214 | const gap = fps.reduce((max, entry) => Math.max(max, entry.dur), 0) |
| 215 | const jank = fps.filter((entry) => entry.dur > 32).length |
| 216 | batch(() => { |
| 217 | setState("fps", total > 0 ? (fps.length * 1000) / total : undefined) |
| 218 | setState("gap", gap > 0 ? gap : undefined) |
| 219 | setState("jank", jank) |
| 220 | }) |
| 221 | } |
| 222 | |
| 223 | const syncLong = (at = performance.now()) => { |
| 224 | if (!hasLong) return |