Improve meminfo parse logic
This commit is contained in:
parent
820598b1b8
commit
6f6f3cedd9
1 changed files with 1 additions and 6 deletions
|
@ -72,12 +72,7 @@ class Module(core.module.Module):
|
||||||
data = {}
|
data = {}
|
||||||
with open("/proc/meminfo", "r") as f:
|
with open("/proc/meminfo", "r") as f:
|
||||||
# https://bugs.python.org/issue32933
|
# https://bugs.python.org/issue32933
|
||||||
while True:
|
for line in f.readlines():
|
||||||
line = f.readline()
|
|
||||||
|
|
||||||
if line == '':
|
|
||||||
break
|
|
||||||
|
|
||||||
tmp = re.split(r"[:\s]+", line)
|
tmp = re.split(r"[:\s]+", line)
|
||||||
value = int(tmp[1])
|
value = int(tmp[1])
|
||||||
if tmp[2] == "kB":
|
if tmp[2] == "kB":
|
||||||
|
|
Loading…
Reference in a new issue