fixed bug in cpu monitor

This commit is contained in:
= 2024-08-05 22:44:35 -04:00
parent f8cee87170
commit ecbb5e8ede

View File

@ -102,7 +102,7 @@ class CPUMonitor:
self.history_times = self.history_times[-self.max_history_size:]
cpu_percentages = [sum(core_history) / self.max_history_size for core_history in self.cpu_usage_history]
# Somehow cpu_percentages can have values greater than 1 so we clamp them
return [min(1.0, cpu_percentage) for cpu_percentage in cpu_percentages]
return cpu_percentages
except Exception as e:
print(f"Error in CPUMonitor.get(): {e}")
return [0] * self.cpu_count