fixed bug in cpu monitor
This commit is contained in:
parent
f8cee87170
commit
ecbb5e8ede
@ -102,7 +102,7 @@ class CPUMonitor:
|
|||||||
self.history_times = self.history_times[-self.max_history_size:]
|
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]
|
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
|
# 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:
|
except Exception as e:
|
||||||
print(f"Error in CPUMonitor.get(): {e}")
|
print(f"Error in CPUMonitor.get(): {e}")
|
||||||
return [0] * self.cpu_count
|
return [0] * self.cpu_count
|
||||||
|
Loading…
Reference in New Issue
Block a user