MCPcopy Index your code
hub / github.com/ChartGPU/ChartGPU / startStatsLoop

Function startStatsLoop

examples/candlestick-streaming/main.ts:504–528  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

502}
503
504function startStatsLoop() {
505 function updateLoop() {
506 frameCount++;
507 const now = performance.now();
508
509 // FPS calculation (every 500ms)
510 if (now - lastFpsTime >= 500) {
511 fps = Math.round(frameCount / ((now - lastFpsTime) / 1000));
512 frameCount = 0;
513 lastFpsTime = now;
514 }
515
516 // Ticks/sec calculation
517 if (now - lastTickTime >= 1000) {
518 const currentTicks = tickSimulator.getTickCount();
519 ticksPerSec = currentTicks - lastTickCount;
520 lastTickCount = currentTicks;
521 lastTickTime = now;
522 }
523
524 updateStats();
525 requestAnimationFrame(updateLoop);
526 }
527 requestAnimationFrame(updateLoop);
528}
529
530function updateStats() {
531 document.getElementById('stat-fps')!.textContent = `${fps}`;

Callers 1

initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected