MCPcopy Create free account
hub / github.com/cppla/ServerStatus / get_memory

Function get_memory

clients/client-linux.py:68–81  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

66 return int(uptime[0])
67
68def get_memory():
69 re_parser = re.compile(r'^(?P<key>\S*):\s*(?P<value>\d*)\s*kB')
70 result = dict()
71 for line in open('/proc/meminfo'):
72 match = re_parser.match(line)
73 if not match:
74 continue
75 key, value = match.groups(['key', 'value'])
76 result[key] = int(value)
77 MemTotal = float(result['MemTotal'])
78 MemUsed = MemTotal-float(result['MemFree'])-float(result['Buffers'])-float(result['Cached'])-float(result['SReclaimable'])
79 SwapTotal = float(result['SwapTotal'])
80 SwapFree = float(result['SwapFree'])
81 return int(MemTotal), int(MemUsed), int(SwapTotal), int(SwapFree)
82
83def get_hdd():
84 valid_fs = {

Callers 1

client-linux.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected