I'm using psutil to remove the CPU load with python.
My problem is that with "top" in Linux shows:
top - 11:45:52 up 12:39, 1 user, load average: 0.07, 0.07, 0.09
Tasks: 58 total, 1 running, 57 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.4 us, 0.1 sy, 0.0 ni, 99.5 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem: 2097152 total, 315124 used, 1782028 free, 0 buffers
KiB Swap: 524288 total, 0 used, 524288 free, 139628 cached
In python view Usage : 3.75%
Mi code in python is:
proc = psutil.cpu_count()
for x in range(proc):
suma = suma + psutil.cpu_percent(interval=1)
usecpu = suma / proc
print(usecpu)
Thanks for help
Aucun commentaire:
Enregistrer un commentaire