2011/4/15 KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>: > Per (host) cpu activity of VMs are very insterested numbers > when running VMs on large SMPs. virt-top -1 mode tries to > provide the information. (But it's not implemented.) > > This patch adds a libvirt interface to get per cpu statistics > of each nodes. This patch just adds an interface and driver > entry points. So, > Â- doesn't include patches for python. > Â- doesn't include any driver. > > Following patches will add some drivers and codes for python. > > Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> > --- > Âinclude/libvirt/libvirt.h.in |  13 ++++++++++ > Âsrc/driver.h         |  Â6 ++++ > Âsrc/esx/esx_driver.c     |  Â1 + > Âsrc/libvirt.c        Â|  55 ++++++++++++++++++++++++++++++++++++++++++ > Âsrc/libvirt_public.syms   Â|  Â4 +++ > Âsrc/libxl/libxl_driver.c   |  Â1 + > Âsrc/lxc/lxc_driver.c     |  Â1 + > Âsrc/openvz/openvz_driver.c  |  Â1 + > Âsrc/phyp/phyp_driver.c    |  Â1 + > Âsrc/qemu/qemu_driver.c    |  Â1 + > Âsrc/remote/remote_driver.c  |  Â1 + > Âsrc/test/test_driver.c    |  Â1 + > Âsrc/uml/uml_driver.c     |  Â1 + > Âsrc/vbox/vbox_tmpl.c     |  Â1 + > Âsrc/vmware/vmware_driver.c  |  Â1 + > Âsrc/xen/xen_driver.c     |  Â1 + > Âsrc/xenapi/xenapi_driver.c  |  Â1 + > Â17 files changed, 91 insertions(+), 0 deletions(-) > > diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in > index 5783303..6b9292c 100644 > --- a/include/libvirt/libvirt.h.in > +++ b/include/libvirt/libvirt.h.in > @@ -400,6 +400,13 @@ struct _virDomainMemoryStat { > > Âtypedef virDomainMemoryStatStruct *virDomainMemoryStatPtr; > > +typedef struct _virDomainPcpuStat virDomainPcpuStatStruct; > + > +struct _virDomainPcpuStat { > +  Âunsigned long long cpuTime; > +}; > + NACK to adding another public struct to the API. It's not expendable. As a stylistic nit pleas don't use the term PCPU as this looks like "Physical CPU". Just call it virDomainPerVcpuStat at least. Also do you really need the absolute CPU time? As noted elsewhere, this is in fact not implementable for ESX. But ESX can provide the virtual CPU utilization in MHz and percent. See the virNodeGetCpuTime series [1] for a better approach. [1] https://www.redhat.com/archives/libvir-list/2011-April/msg00702.html Matthias -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list