forked from genewildish/Mainline
fix(display): correct FPS calculation in all display backends
BUG: FPS display showed incorrect values (e.g., >1000 when actual FPS was ~60)
ROOT CAUSE: Display backends were looking for avg_ms at the wrong level
in the stats dictionary. The PerformanceMonitor.get_stats() returns:
{
'frame_count': N,
'pipeline': {'avg_ms': X, ...},
'effects': {...}
}
But the display backends were using:
avg_ms = stats.get('avg_ms', 0) # ❌ Returns 0 (not found at top level)
FIXED: All display backends now use:
avg_ms = stats.get('pipeline', {}).get('avg_ms', 0) # ✅ Correct path
Updated backends:
- engine/display/backends/terminal.py
- engine/display/backends/websocket.py
- engine/display/backends/sixel.py
- engine/display/backends/pygame.py
- engine/display/backends/kitty.py
Now FPS displays correctly (e.g., 60 FPS for 16.67ms avg frame time).
This commit is contained in:
@@ -173,7 +173,7 @@ class PygameDisplay:
|
||||
monitor = get_monitor()
|
||||
if monitor:
|
||||
stats = monitor.get_stats()
|
||||
avg_ms = stats.get("avg_ms", 0) if stats else 0
|
||||
avg_ms = stats.get("pipeline", {}).get("avg_ms", 0) if stats else 0
|
||||
frame_count = stats.get("frame_count", 0) if stats else 0
|
||||
if avg_ms and frame_count > 0:
|
||||
fps = 1000.0 / avg_ms
|
||||
|
||||
Reference in New Issue
Block a user