python -c "import psutil;print(psutil.cpu_percent())"
Output: 0.0
python # we're in the interpreter now
import psutil
print(psutil.cpu_percent())
output: 12.7
what's going on here? when running it outside of the interpreter I always get either 0.0 or 100.0 so I assume it's reporting only itself's cpu usage percentage in this case.
But I'm curious as to why and how the same code isn't acting consitently as a script vs being executed in the interpreter.
Found the 'expected behavior' of the lib here: CPU usage of python script