Browse Source

rm bytes2human which not presented in psutil 5.6.1

tags/v0.6.0-beta
Li Hongzhang 5 years ago
parent
commit
8dbbf2288b
1 changed files with 2 additions and 9 deletions
  1. +2
    -9
      mindinsight/sysmetric/collector/_collect_mem.py

+ 2
- 9
mindinsight/sysmetric/collector/_collect_mem.py View File

@@ -15,20 +15,13 @@
"""The memory collector."""

import psutil
from psutil._common import bytes2human


def collect_mem(readable=False):
def collect_mem():
"""
Collect the virtual memory info.

Args:
readable (bool): Read the sizes like 1K, 234M, 2G etc.

Returns:
dict, the virtual memory info.
"""
mem = 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()}
return dict(psutil.virtual_memory()._asdict())

Loading…
Cancel
Save