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
I am using psutil in python 2.7 to get the cpu percent of the process, however, it always get 0.0 for current process. The system cpu percent is correct, and the cpu_time per process is also increased.
here is the test code which I am using:
def test_monitor():
while True:
cpu_times = psutil.cpu_times()
print(cpu_times)
cpu_percent = psutil.cpu_percent()
print(cpu_percent)
p = psutil.Process()
p_cpu_times = p.cpu_times()
print(p_cpu_times)
cpu_percent = p.cpu_percent(1)
print(cpu_percent)
for i in range(10000000):
j = i * i
time.sleep(0.1)
Hi,
I am using psutil in python 2.7 to get the cpu percent of the process, however, it always get 0.0 for current process. The system cpu percent is correct, and the cpu_time per process is also increased.
here is the test code which I am using:
Here is the output of the test code:
Can anybody help to check where's the problem? thank you.
Best Regards,
Qing
The text was updated successfully, but these errors were encountered: