[libvirt-users] cpu time totals

Eric Blake eblake at redhat.com
Tue Sep 13 21:53:42 UTC 2011

On 09/13/2011 03:46 PM, Igor Serebryany wrote:
> Hi!
> 	I'm comparing the cpu usage of a VM from virDomainGetInfo and the
> 	usages returned per-vcpu from virDomainGetVcpus and the totals do
> 	not match up.
> 	I expect that the cpu usages reported per-vcpu, when summed, should
> 	equal the total cpu usage of the domain, but there is quite a large
> 	gap between them. Is there something I'm missing?

Yes - emulation overhead.  That is, there is some work done by the 
hypervisor process itself but not directly attributable to any of the 
work done by the vcpus visible in the guest.  For example, in qemu, the 
time spent in opening qcow2 files counts against the overall domain 
time, but not towards any of the vcpu times.

> 	Why is this additional 91 seconds not reflected in time spent by the
> 	vcpus? What exactly is the meaning of the cpuTime parameter of the
> 	virVcpuInfo struct?

How much total time has been occupied by the overall hypervisor instance 
running the domain, which is probably larger than the amount of vcpu 
time racked up from the child's point of view.  The smaller the 
overhead, the more efficient the virtualization.

Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

More information about the libvirt-users mailing list