def _get_memory_stats(self):
mem_info = {'virtual': {}, 'swap': {}}
v_mem = ps.virtual_memory()
s_mem = ps.swap_memory()
_c = mem_info['virtual']
_c['total'] = v_mem.total
_c['used'] = v_mem.used
_c['free'] = v_mem.free
_c['used_percent'] = v_mem.percent
_c = mem_info['swap']
_c['total'] = s_mem.total
_c['used'] = s_mem.used
_c['free'] = s_mem.free
_c['used_percent'] = s_mem.percent
return mem_info
评论列表
文章目录