Reputation: 11
I am trying to write a program that can measure the overall CPU usage.
I tried using psutil.cpu_percent()
,
but it is returning the CPU usage for only the python process.
Upvotes: 1
Views: 802
Reputation:
import psutil
psutil.cpu_percent(5)
Count it for multiple seconds, will return the average cpu usage in 5 seconds. psutil.cpu_percent() Only gets the usage in the current moment, Which can go from 1 to 50+ in a few ms.
Upvotes: 1