[libvirt-users] cpuTimes and qemu-kvm on F13

Daniel P. Berrange berrange at redhat.com
Sat Aug 14 19:54:56 UTC 2010


On Fri, Aug 13, 2010 at 08:42:21PM -0400, Matthew Farrellee wrote:
> http://libvirt.org/html/libvirt-libvirt.html#virDomainInfo
> http://libvirt.org/html/libvirt-libvirt.html#virVcpuInfo
> 
> Both virDomainInfo and virVcpuInfo have a nanosecond cpuTime field. How 
> do the two related to one another?
> 
> With some experiementing, it appears the virDomainInfo::cpuTime is equal 
> to the host CPU time used by the qemu-kvm process for the domain. It 
> also appears that the sum(virVcpuInfo::cpuTime) for a domain is not 
> equal to the virDomainInfo::cpuTime. Is the virVcpuInfo::cpuTime how 
> much host CPU time was spent simulating the vCPU? Making the difference 
> between the sum and the virDomainInfo::cpuTime the overhead of qemu-kvm?

Yes, virVcpuInfo::cpuTime is the execution time for a single vCPU,
while virDomainInfo::cpuTime is execution time for the whole VM.
QEMU has other non-VCPU threads, eg I/O threads, which is where
the discrepancy you see comes in.

> Does the relationship hold for other hypervisors?

Yes & no. The 'whole VM' execution time is somewhat hard to actually
define & report. eg QEMU with vhost enabled has a kernel thread
doing some work that we are unable to report/account under the
'whole VM' time. With Xen meanwhile the 'whole VM' time is only
really counting the time associated with the guest domain context,
not stuff running in Dom0 context on behalf of the VM - eg qemu-dm
time. IIUC, with stub domains that is resolved

Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvirt-users mailing list