direct-io.hg

changeset 15518:3f2d2adc87f7

xend: Count CPUs rather than relying on a static
nodes/sockets/cores/threads relationship.
Signed-off-by: Alex Williamson <alex.williamson@hp.com>
author kfraser@localhost.localdomain
date Tue Jul 10 10:13:16 2007 +0100 (2007-07-10)
parents b476c756ad4f
children 80099a459d7a
files tools/python/xen/xend/XendNode.py
line diff
     1.1 --- a/tools/python/xen/xend/XendNode.py	Tue Jul 10 10:11:14 2007 +0100
     1.2 +++ b/tools/python/xen/xend/XendNode.py	Tue Jul 10 10:13:16 2007 +0100
     1.3 @@ -580,14 +580,17 @@ class XendNode:
     1.4              str='none\n'
     1.5          return str[:-1];
     1.6  
     1.7 +    def count_cpus(self, pinfo):
     1.8 +        count=0
     1.9 +        node_to_cpu=pinfo['node_to_cpu']
    1.10 +        for i in range(0, pinfo['nr_nodes']):
    1.11 +            count+=len(node_to_cpu[i])
    1.12 +        return count;
    1.13  
    1.14      def physinfo(self):
    1.15          info = self.xc.physinfo()
    1.16  
    1.17 -        info['nr_cpus'] = (info['nr_nodes'] *
    1.18 -                           info['sockets_per_node'] *
    1.19 -                           info['cores_per_socket'] *
    1.20 -                           info['threads_per_core'])
    1.21 +        info['nr_cpus'] = self.count_cpus(info)
    1.22          info['cpu_mhz'] = info['cpu_khz'] / 1000
    1.23          
    1.24          # physinfo is in KiB, need it in MiB