- Add markDirty() calls to setProperty() methods in: - UISprite: position, scale, sprite_index changes - UICaption: position, font_size, colors, text changes - UIGrid: position, size, center, zoom, color changes - UILine: thickness, position, endpoints, color changes - UICircle: radius, position, colors changes - UIArc: radius, angles, position, color changes - UIEntity: position changes propagate to parent grid - Expand getMetrics() Python API to include detailed timing breakdown: - grid_render_time, entity_render_time, fov_overlay_time - python_time, animation_time - grid_cells_rendered, entities_rendered, total_entities - Add comprehensive benchmark suite (tests/benchmarks/benchmark_suite.py): - 6 scenarios: empty, static UI, animated UI, mixed, deep hierarchy, grid stress - Automated metrics collection and performance assessment - Timing breakdown percentages This enables proper dirty flag propagation for the upcoming texture caching system (#144) and provides infrastructure for performance benchmarking (#104). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
6c496b8732
commit
219a559c35
9 changed files with 442 additions and 3 deletions
|
|
@ -1233,17 +1233,29 @@ PyObject* McRFPy_API::_getMetrics(PyObject* self, PyObject* args) {
|
|||
// Create a dictionary with metrics
|
||||
PyObject* dict = PyDict_New();
|
||||
if (!dict) return NULL;
|
||||
|
||||
|
||||
// Add frame time metrics
|
||||
PyDict_SetItemString(dict, "frame_time", PyFloat_FromDouble(game->metrics.frameTime));
|
||||
PyDict_SetItemString(dict, "avg_frame_time", PyFloat_FromDouble(game->metrics.avgFrameTime));
|
||||
PyDict_SetItemString(dict, "fps", PyLong_FromLong(game->metrics.fps));
|
||||
|
||||
|
||||
// Add draw call metrics
|
||||
PyDict_SetItemString(dict, "draw_calls", PyLong_FromLong(game->metrics.drawCalls));
|
||||
PyDict_SetItemString(dict, "ui_elements", PyLong_FromLong(game->metrics.uiElements));
|
||||
PyDict_SetItemString(dict, "visible_elements", PyLong_FromLong(game->metrics.visibleElements));
|
||||
|
||||
|
||||
// #144 - Add detailed timing breakdown (in milliseconds)
|
||||
PyDict_SetItemString(dict, "grid_render_time", PyFloat_FromDouble(game->metrics.gridRenderTime));
|
||||
PyDict_SetItemString(dict, "entity_render_time", PyFloat_FromDouble(game->metrics.entityRenderTime));
|
||||
PyDict_SetItemString(dict, "fov_overlay_time", PyFloat_FromDouble(game->metrics.fovOverlayTime));
|
||||
PyDict_SetItemString(dict, "python_time", PyFloat_FromDouble(game->metrics.pythonScriptTime));
|
||||
PyDict_SetItemString(dict, "animation_time", PyFloat_FromDouble(game->metrics.animationTime));
|
||||
|
||||
// #144 - Add grid-specific metrics
|
||||
PyDict_SetItemString(dict, "grid_cells_rendered", PyLong_FromLong(game->metrics.gridCellsRendered));
|
||||
PyDict_SetItemString(dict, "entities_rendered", PyLong_FromLong(game->metrics.entitiesRendered));
|
||||
PyDict_SetItemString(dict, "total_entities", PyLong_FromLong(game->metrics.totalEntities));
|
||||
|
||||
// Add general metrics
|
||||
PyDict_SetItemString(dict, "current_frame", PyLong_FromLong(game->getFrame()));
|
||||
PyDict_SetItemString(dict, "runtime", PyFloat_FromDouble(game->runtime.getElapsedTime().asSeconds()));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue