feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data - Track frame time (current and 60-frame rolling average) - Calculate FPS from average frame time - Count draw calls, UI elements, and visible elements per frame - Track total runtime and current frame number - PyScene counts elements during render - Expose metrics via mcrfpy.getMetrics() returning dict This provides basic performance monitoring capabilities for identifying bottlenecks and optimizing rendering performance. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
1c7195a748
commit
f23aa784f2
5 changed files with 80 additions and 3 deletions
|
|
@ -72,8 +72,16 @@ void PyScene::render()
|
|||
// Render in sorted order (no need to copy anymore)
|
||||
for (auto e: *ui_elements)
|
||||
{
|
||||
if (e)
|
||||
if (e) {
|
||||
// Track metrics
|
||||
game->metrics.uiElements++;
|
||||
if (e->visible) {
|
||||
game->metrics.visibleElements++;
|
||||
// Count this as a draw call (each visible element = 1+ draw calls)
|
||||
game->metrics.drawCalls++;
|
||||
}
|
||||
e->render();
|
||||
}
|
||||
}
|
||||
|
||||
// Display is handled by GameEngine
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue