[libvirt-users] cpu time totals

Igor Serebryany igor47 at moomers.org
Tue Sep 13 21:46:24 UTC 2011


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?

	See this example code using the python bindings:

>>> import libvirt
>>> c = libvirt.open('qemu:///system')
>>> d = c.lookupByID(51)
>>> d.info()[4]
111390000000L
>>> d.vcpus()[0]
[(0, 1, 12720000000L, 1), (1, 1, 2980000000L, 0), (2, 1, 3150000000L, 1), (3, 1, 2600000000L, 0)]
>>> sum([vcpu[2] for vcpu in d.vcpus()[0]])
21520000000L
>>> d.info()[4] - sum([vcpu[2] for vcpu in d.vcpus()[0]])
91760000000L

	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?

Thanks,
--Igor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20110913/3a52bd39/attachment.sig>


More information about the libvirt-users mailing list