From 4aefa1d50177906cd206150c768cca4a8e13da08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guti=C3=A9rrez=20Hermosillo=20Muriedas=2C=20Juan=20Pedro?= Date: Thu, 19 Sep 2024 10:54:42 +0200 Subject: [PATCH] fix: fixed wrong assumption on number of core freq elements --- perun/backend/psutil.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/perun/backend/psutil.py b/perun/backend/psutil.py index 4c1587f..2b0055b 100644 --- a/perun/backend/psutil.py +++ b/perun/backend/psutil.py @@ -59,9 +59,8 @@ def availableSensors(self) -> Dict[str, Tuple]: sensors["DISK_WRITE_BYTES"] = (self.id, DeviceType.DISK, Unit.BYTE) if psutil.cpu_freq(percpu=True) is not None: - for i in range(psutil.cpu_count()): - if psutil.cpu_freq(percpu=True)[i].current is not None: - sensors[f"CPU_FREQ_{i}"] = (self.id, DeviceType.CPU, Unit.HZ) + for cpu_id, _ in enumerate(psutil.cpu_freq(percpu=True)): + sensors[f"CPU_FREQ_{cpu_id}"] = (self.id, DeviceType.CPU, Unit.HZ) return sensors def _getCallback(self, device: str) -> Callable[[], np.number]: