memory - Detect swapping in python -


what best way determine if computer running script using swap memory? should cross-platform possible. 1 solution run program top subprocess, hope there's better way.

you can use module psutil. not module in standard library though , have install using pip package manager.

pip install psutil 

the swap usage data can gathered using psutil.swap_memory(). returns named tuple.

>>> import psutil >>> psutil.swap_memory() sswap(total=2097147904l, used=886620160l, free=1210527744l, percent=42.3, sin=1050411008, sout=1906720768) 

Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -