When interval is 0.0 or None compares system CPU times elapsed since last call or module import, returning immediately. When interval is > 0.0 compares system CPU times elapsed before and after the interval (blocking). Return a float representing the current system-wide CPU utilization as a percentage. Psutil.cpu_percent(interval=None, percpu=False) Individual CPUs: 11.00% 8.50% 11.90% 8.50% 9.90% 7.60% 11.50% 12.30%įor more information on how the psutil.cpu_percent(interval=2) python call works, see the official psutil.cpu_percent(interval=None, percpu=False) documentation here: Sample output: notice that I have 8 cores, so there are 8 numbers after "Individual CPUs:": Total: 10.15% printf "%b" "import psutil\nprint(''.format(' '.join(cpu_percent_cores_str)))\n\ This calls python3 and uses the cross-platform psutil module.
0 Comments
Leave a Reply. |