feat: enhance telemetry metrics with target FPS tracking and logging
This commit is contained in:
@@ -24,6 +24,15 @@ class TelemetryOverlay(IOverlayLayer):
|
||||
overlay = TelemetryOverlay()
|
||||
camera_view.add_overlay_layer(overlay)
|
||||
telemetry_collector.metrics_updated.connect(overlay.on_metrics_updated)
|
||||
|
||||
Display format:
|
||||
FPS req 60.0 ← what was requested from camera
|
||||
FPS got 30.2 ← what camera actually delivered
|
||||
Frame 33.1 ms
|
||||
Drop 0
|
||||
CPU sys 14.8 % ← normalised by cpu_count (matches Task Manager)
|
||||
CPU core 118.4 % ← per single core (can exceed 100%)
|
||||
Mem 68 MB
|
||||
"""
|
||||
|
||||
def __init__(self) -> None:
|
||||
@@ -60,7 +69,6 @@ class TelemetryOverlay(IOverlayLayer):
|
||||
box_w = max_width + OVERLAY_PADDING * 2
|
||||
box_h = line_height * len(lines) + OVERLAY_PADDING * 2
|
||||
|
||||
# Position relative to the actual video area, not the full widget
|
||||
x = video_rect.left() + OVERLAY_MARGIN
|
||||
y = video_rect.top() + OVERLAY_MARGIN
|
||||
|
||||
@@ -83,12 +91,19 @@ class TelemetryOverlay(IOverlayLayer):
|
||||
|
||||
@staticmethod
|
||||
def _format_lines(snap: TelemetrySnapshot) -> list[str]:
|
||||
lines = [
|
||||
f"FPS {snap.fps:>6.1f}",
|
||||
f"Frame {snap.frame_time_ms:>6.1f} ms",
|
||||
f"Drop {snap.dropped_frames:>6d}",
|
||||
f"CPU {snap.cpu_percent:>5.1f} %",
|
||||
]
|
||||
lines: list[str] = []
|
||||
|
||||
# FPS — show target if known, then actual
|
||||
if snap.target_fps is not None:
|
||||
lines.append(f"FPS req {snap.target_fps:>6.1f}")
|
||||
lines.append(f"FPS got {snap.fps:>6.1f}")
|
||||
|
||||
lines.append(f"Frame {snap.frame_time_ms:>6.1f} ms")
|
||||
lines.append(f"Drop {snap.dropped_frames:>6d}")
|
||||
lines.append(f"CPU sys {snap.cpu_percent_sys:>5.1f} %")
|
||||
lines.append(f"CPU core {snap.cpu_percent_core:>5.1f} %")
|
||||
|
||||
if snap.memory_mb is not None:
|
||||
lines.append(f"Mem {snap.memory_mb:>5.0f} MB")
|
||||
lines.append(f"Mem {snap.memory_mb:>5.0f} MB")
|
||||
|
||||
return lines
|
||||
|
||||
Reference in New Issue
Block a user