Im trying to measure the cpu usage of a process tree.
Currently getting the cpu_usage of a process (without children) will do, but I'm getting weird results.
import psutil
p = psutil.Process(PID)
p.cpu_percent
gives me back float
>100
, how is that even possible?
btw PID
is the pid of something simple as
def foo():
i = 0
while True:
i += 1
which according to task manager its cpu usage is around 12%
I want to get an output of 12.5
or something like that.