thermald: make CPU usage list a constant size (#31526)

old-commit-hash: 3e6ac26569
chrysler-long2
Adeeb Shihadeh 1 year ago committed by GitHub
parent 22e8a76cd9
commit 1f13b0904c
  1. 4
      selfdrive/thermald/thermald.py

@ -245,8 +245,10 @@ def thermald_thread(end_event, hw_queue) -> None:
msg.deviceState.freeSpacePercent = get_available_percent(default=100.0) msg.deviceState.freeSpacePercent = get_available_percent(default=100.0)
msg.deviceState.memoryUsagePercent = int(round(psutil.virtual_memory().percent)) msg.deviceState.memoryUsagePercent = int(round(psutil.virtual_memory().percent))
msg.deviceState.cpuUsagePercent = [int(round(n)) for n in psutil.cpu_percent(percpu=True)]
msg.deviceState.gpuUsagePercent = int(round(HARDWARE.get_gpu_usage_percent())) msg.deviceState.gpuUsagePercent = int(round(HARDWARE.get_gpu_usage_percent()))
online_cpu_usage = [int(round(n)) for n in psutil.cpu_percent(percpu=True)]
offline_cpu_usage = [0., ] * (len(msg.deviceState.cpuTempC) - len(online_cpu_usage))
msg.deviceState.cpuUsagePercent = online_cpu_usage + offline_cpu_usage
msg.deviceState.networkType = last_hw_state.network_type msg.deviceState.networkType = last_hw_state.network_type
msg.deviceState.networkMetered = last_hw_state.network_metered msg.deviceState.networkMetered = last_hw_state.network_metered

Loading…
Cancel
Save