tools/python: expose xc_getcpuinfo()
authorZhigang Wang <zhigang.x.wang@oracle.com>
Tue, 13 May 2014 20:32:33 +0000 (16:32 -0400)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 15 May 2014 15:12:52 +0000 (16:12 +0100)
commita9958947e49644c917c2349a567b2005b08e7c1f
treec887fb4b9e540ad23cbfb77112ccd4253e56a3b4
parent9aa2cef51f3dced396a5ae10de586206956f9ffd
tools/python: expose xc_getcpuinfo()

This API can be used to get per physical CPU utilization.

Testing:

      # python
      >>> import xen.lowlevel.xc
      >>> xc = xen.lowlevel.xc.xc()
      >>> xc.getcpuinfo()
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
      TypeError: Required argument 'max_cpus' (pos 1) not found
      >>> xc.getcpuinfo(4)
      [{'idletime': 109322086128854}, {'idletime': 109336447648802},
      {'idletime': 109069270544960}, {'idletime': 109065612611363}]
      >>> xc.getcpuinfo(100)
      [{'idletime': 109639015806078}, {'idletime': 109654551195681},
      {'idletime': 109382107891193}, {'idletime': 109382057541119}]
      >>> xc.getcpuinfo(1)
      [{'idletime': 109682068418798}]
      >>> xc.getcpuinfo(2)
      [{'idletime': 109711311201330}, {'idletime': 109728458214729}]
      >>> xc.getcpuinfo(max_cpus=4)
      [{'idletime': 109747116214638}, {'idletime': 109764982453261},
      {'idletime': 109491373228931}, {'idletime': 109489858724432}]

Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/python/xen/lowlevel/xc/xc.c