Skip to content

Commit 857dd3b

Browse files
[rqd] Fix swap memory on Linux (#1447)
- Add the render host's total_mem, total_swap in the initMachineStats function. - Specify file encoding when opening `/proc/meminfo`. This logic was removed on 18/Dec/2018 at 11:04 in the pull request: Add build and packaging for RQD. (#48), cfd6e6b
1 parent 039a27a commit 857dd3b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

rqd/rqd/rqmachine.py

+9
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from builtins import range
3030
from builtins import object
3131

32+
import codecs
3233
import ctypes
3334
import errno
3435
import logging
@@ -618,6 +619,14 @@ def __initMachineStats(self, pathCpuInfo=None):
618619
# An entry without data
619620
elif len(lineList) == 1:
620621
currCore[lineList[0]] = ""
622+
623+
# Reads information from /proc/meminfo
624+
with codecs.open(rqd.rqconstants.PATH_MEMINFO, "r", encoding="utf-8") as fp:
625+
for line in fp:
626+
if line.startswith("MemTotal"):
627+
self.__renderHost.total_mem = int(line.split()[1])
628+
elif line.startswith("SwapTotal"):
629+
self.__renderHost.total_swap = int(line.split()[1])
621630
else:
622631
hyperthreadingMultiplier = 1
623632

0 commit comments

Comments
 (0)