You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Type: python virtual environment running with VScode
CPU: r7 5700x
Description
getloadavg() only returns a zeroed-out tuple i.e. (0.0, 0.0, 0.0) when used on windows 11. I've already narrowed it down to this part load = psutil.getloadavg()[0]
On Windows this is emulated by using a Windows API that spawns a thread which keeps running in background and updates results every 5 seconds, mimicking the UNIX behavior. Thus, on Windows, the first time this is called and for the next 5 seconds it will return a meaningless (0.0, 0.0, 0.0) tuple.
You should be able to see meaningful results if you call getloadavg() again after 5 secs.
Can confirm having the same issue as OP - I only get values when setting interval to any value different than None. But as I do not want a blocking call I cannot use it that way.
Summary
Description
getloadavg()
only returns a zeroed-out tuple i.e.(0.0, 0.0, 0.0)
when used on windows 11. I've already narrowed it down to this partload = psutil.getloadavg()[0]
The code example below is from one of my projects utilizing psutil. if I were to have this function where CPU percent is in this code: https://github.com/FyreX-opensource-design/open-system-monitor/blob/main/app.py, the Core load would display 0.0 % on the webpage
The text was updated successfully, but these errors were encountered: