提交 8dbbf228 编写于 作者: L Li Hongzhang

rm bytes2human which not presented in psutil 5.6.1

上级 a589d02c
...@@ -15,20 +15,13 @@ ...@@ -15,20 +15,13 @@
"""The memory collector.""" """The memory collector."""
import psutil import psutil
from psutil._common import bytes2human
def collect_mem(readable=False): def collect_mem():
""" """
Collect the virtual memory info. Collect the virtual memory info.
Args:
readable (bool): Read the sizes like 1K, 234M, 2G etc.
Returns: Returns:
dict, the virtual memory info. dict, the virtual memory info.
""" """
mem = psutil.virtual_memory()._asdict() return dict(psutil.virtual_memory()._asdict())
if not readable:
return dict(mem)
return {k: v if k == 'percent' else bytes2human(v) for k, v in mem.items()}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册