[svn r58108] A hyperthreaded cpu core should only count as 1, although it is present as 2
entries in /proc/cpuinfo. Counting it as 2 is misleading because it is *by far* not as efficient as two independent cores. --HG-- branch : trunk
This commit is contained in:
parent
bb9b0e7361
commit
2a706fc8ae
|
@ -65,18 +65,26 @@ class RemoteInfo:
|
||||||
|
|
||||||
def getcpuinfo(self):
|
def getcpuinfo(self):
|
||||||
if self.islinux():
|
if self.islinux():
|
||||||
return self.exreceive("""
|
return self.exreceive("""
|
||||||
numcpus = 0
|
# a hyperthreaded cpu core only counts as 1, although it
|
||||||
model = None
|
# is present as 2 in /proc/cpuinfo. Counting it as 2 is
|
||||||
for line in open("/proc/cpuinfo"):
|
# misleading because it is *by far* not as efficient as
|
||||||
if not line.strip():
|
# two independent cores.
|
||||||
continue
|
cpus = {}
|
||||||
key, value = line.split(":")
|
cpuinfo = {}
|
||||||
key = key.strip()
|
f = open("/proc/cpuinfo")
|
||||||
if key == "processor":
|
lines = f.readlines()
|
||||||
numcpus += 1
|
f.close()
|
||||||
elif key == "model name":
|
for line in lines + ['']:
|
||||||
model = value.strip()
|
if line.strip():
|
||||||
|
key, value = line.split(":", 1)
|
||||||
|
cpuinfo[key.strip()] = value.strip()
|
||||||
|
else:
|
||||||
|
corekey = (cpuinfo.get("physical id"),
|
||||||
|
cpuinfo.get("core id"))
|
||||||
|
cpus[corekey] = 1
|
||||||
|
numcpus = len(cpus)
|
||||||
|
model = cpuinfo.get("model name")
|
||||||
channel.send((numcpus, model))
|
channel.send((numcpus, model))
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue