diff options
author | Clark Williams <williams@redhat.com> | 2016-11-26 22:33:05 -0600 |
---|---|---|
committer | Clark Williams <williams@redhat.com> | 2016-11-26 22:33:05 -0600 |
commit | c428efc3cbdda94bd392d904fe02a2d1403e70a0 (patch) | |
tree | b0bd33cd0dfcda959565d5e27514fc171812860a | |
parent | 433768759bc852f2641d027c8315aaa6772084ad (diff) | |
download | rteval-c428efc3cbdda94bd392d904fe02a2d1403e70a0.tar.gz |
systopology: fix calls to common _sysread() function
Signed-off-by: Clark Williams <williams@redhat.com>
-rw-r--r-- | rteval/sysinfo/systopology.py | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/rteval/sysinfo/systopology.py b/rteval/sysinfo/systopology.py index a988907..cd242aa 100644 --- a/rteval/sysinfo/systopology.py +++ b/rteval/sysinfo/systopology.py @@ -27,7 +27,7 @@ import os, sys import os.path import glob -def __sysread(path, obj): +def _sysread(path, obj): fp = open(os.path.join(path,obj), "r") return fp.readline().strip() @@ -112,7 +112,7 @@ class Cpus(object): # find the nodeid of a particular cpu def getnodeid(self, n): cpupath = os.path.join(Cpus.cpupath,'cpu%d' % n) - return int(self.__sysread(cpupath, "topology/physical_package_id")) + return int(_sysread(cpupath, "topology/physical_package_id")) # check whether cpu n is online def isonline(self, n): @@ -120,7 +120,7 @@ class Cpus(object): return True path = os.path.join(Cpus.cpupath,'cpu%d' % n) if os.path.exists(path): - return self.__sysread(path, "online") == 1 + return _sysread(path, "online") == 1 return False # @@ -133,7 +133,7 @@ class NumaNode(object): def __init__(self, path): self.path = path self.nodeid = int(os.path.basename(path)[4:].strip()) - self.cpus = Cpus(self.__sysread(self.path, "cpulist")) + self.cpus = Cpus(_sysread(self.path, "cpulist")) self.getmeminfo() def __contains__(self, cpu): @@ -145,10 +145,6 @@ class NumaNode(object): def __str__(self): return self.getcpustr() - def __sysread(self, path, element): - fp = open(os.path.join(path,element), "r") - return fp.readline().strip() - # read info about memory attached to this node def getmeminfo(self): self.meminfo = {} @@ -204,10 +200,6 @@ class SysTopology(object): self.current += 1 return n - def __sysread(self, path, obj): - fp = open(os.path.join(path, obj), "r") - return fp.readline().strip() - def getinfo(self): nodes = glob.glob(os.path.join(SysTopology.nodepath, 'node[0-9]*')) if not nodes: |