giampaolo / psutil

Cross-platform lib for process and system monitoring in Python
BSD 3-Clause "New" or "Revised" License
10.22k stars 1.38k forks source link

Core usage anomaly #2363

Open MattiaVerticchio opened 8 months ago

MattiaVerticchio commented 8 months ago

Summary

Description

I encountered a bug when using the psutil.cpu_percent(interval=1, percpu=True) function. It returns a list of percentages for each CPU core, but the value for the third core is always very high (around 75-80%) even when the CPU is idling. This does not match the CPU usage shown by Gnome System Monitor.

Screenshot

image

Code ```python import psutil import time for _ in range(10): print(psutil.cpu_percent(interval=1, percpu=True)) time.sleep(1) ```
Output ```python [5.0, 1.0, 76.0, 1.0] [2.0, 3.0, 75.0, 3.0] [3.0, 0.0, 75.0, 3.0] [1.0, 4.0, 75.8, 1.0] [1.0, 4.0, 75.2, 3.0] [1.0, 1.0, 75.2, 3.0] [1.0, 2.0, 75.0, 3.0] [2.0, 5.0, 75.8, 4.0] [2.0, 6.0, 75.0, 1.0] [1.0, 4.0, 75.8, 5.0] ```

I hope this is helpful, thank you for your work on this library! 😁