def psutil_phymem_usage():
"""
Return physical memory usage (float)
Requires the cross-platform psutil (>=v0.3) library
(http://code.google.com/p/psutil/)
"""
# This is needed to avoid a deprecation warning error with
# newer psutil versions
if settings.__PSUTIL__ == False:
return 0.0
try:
percent = psutil.virtual_memory().percent
except:
percent = psutil.phymem_usage().percent
return percent
评论列表
文章目录