from __future__ import annotations import psutil def get_cpu_percent() -> float: return psutil.cpu_percent(interval=0.1) def get_memory_info() -> dict[str, float]: mem = psutil.virtual_memory() return { "total_gb": round(mem.total / (1024**3), 2), "used_gb": round(mem.used / (1024**3), 2), "percent": mem.percent, } def get_telemetry() -> dict[str, float]: return { "cpu_percent": get_cpu_percent(), **get_memory_info(), }