summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2008-03-20 14:13:27 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2008-03-20 14:13:27 -0300
commit6da342f4382725ace479638cede4a3d8e6c4cae4 (patch)
tree44c024984713f116441d301a1d96b14c8f2e0713
parent76a691c279d00f60e4032c03db57e042cf5202dc (diff)
downloadpython-linux-procfs-6da342f4382725ace479638cede4a3d8e6c4cae4.tar.gz
[CPUINFO]: Handle the non-multicore format
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rwxr-xr-xprocfs/procfs.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/procfs/procfs.py b/procfs/procfs.py
index 3bdad94..22f11f9 100755
--- a/procfs/procfs.py
+++ b/procfs/procfs.py
@@ -289,8 +289,9 @@ class cpuinfo:
self.sockets.append(socket_id)
f.close()
- self.nr_sockets = len(self.sockets)
- self.nr_cores = int(self.tags["cpu cores"]) * self.nr_sockets
+ self.nr_sockets = self.sockets and len(self.sockets) or \
+ (self.nr_cpus / ("siblings" in self.tags and int(self.tags["siblings"]) or 1))
+ self.nr_cores = ("cpu cores" in self.tags and int(self.tags["cpu cores"]) or 1) * self.nr_sockets
class smaps_lib:
def __init__(self, lines):