[libvirt] [RFC][PATCHv1 2/5] libvirt - new API for getting percpu statistics of VM

KAMEZAWA Hiroyuki kamezawa.hiroyu at jp.fujitsu.com
Wed Apr 20 08:06:29 UTC 2011


On Wed, 20 Apr 2011 09:32:07 +0200
Matthias Bolte <matthias.bolte at googlemail.com> wrote:

> 2011/4/20 KAMEZAWA Hiroyuki <kamezawa.hiroyu at jp.fujitsu.com>:
> > On Tue, 19 Apr 2011 12:29:05 +0100
> > "Daniel P. Berrange" <berrange at redhat.com> wrote:
> >
> >> On Fri, Apr 15, 2011 at 04:43:03PM +0900, KAMEZAWA Hiroyuki wrote:
> >> > On Fri, 15 Apr 2011 09:43:15 +0200
> >> > Matthias Bolte <matthias.bolte at googlemail.com> wrote:
> >> >
> >> > > 2011/4/15 KAMEZAWA Hiroyuki <kamezawa.hiroyu at jp.fujitsu.com>:
> >> > > Also do you really need the absolute CPU time?
> >> > yes, for virt-top -1.
> >>
> >> I don't think that is correct. What virt-top ultimately displays
> >> to the end user is a % utilization. So it would be happy to get
> >> data in either % util & display that directly, or get absolute
> >> CPU time and calculate deltas to display % util.
> >>
> >
> > virt-top calculate delta by itself.
> >
> >
> >> I wonder if we could provide an API that could be used to provide
> >> either per-VCPU or per-PCPU  statistics in one go, so that we
> >> can finally have an API for cpu time that works well for VMWare.
> >>
> >
> > VMWare ?
> >
> 
> VMware can provide various statistics about a virtual machine, but
> most (actually all, I think) are not provided as absolute values but
> in 20 sec slots with 1h of history (a vCenter can store longer
> history). Therefore, it's nearly impossible to get the absolute CPU
> time of a virtual machine since bootup.
> 
> In most cases the enduser is not interested in the absolute CPU time
> but in the current CPU utilization in percent. VMware already
> calculates the utilization, but libvirt currently has not API to
> expose that.
> 
> http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.PerformanceManager.html
> http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/cpu_counters.html
> 

Hmm, okay. thank you for clarification.

Then, I'll prepare 2 options.

int virDomainGetPhysCPUStatistics(domain, unsigned long long *stats, int nr_stats,
				  enum PhysCPU_Stat);

PhysCPU_ABS_CPUTIME   : Per Physical cpu abosolute usage time of domain.
PhysCPU_UTIL	      : Per Physical cpu utilization of domain. The definition of
                        'utilization' depends on each VM. VMWare can provide its 20sec
                        utilization.
                        KVM will.....maybe 3sec interval is the best because it's
                        'top's default. But I myself don't take care of this interface
                        and leave this as empty. To calculate it in 3sec interval, it seems
                        to run a thread for doing that job. Maybe interval should be configurable
                        by qemu.conf.

If VMWare can provides PerVcpuPhysCPUUtilzation, please add it. I have no idea.

Thanks,
-Kame







More information about the libvir-list mailing list