Question on acquiring cpuTime in struct _virDomainInfo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi everyone,

using libvirt I'm trying to calculate cpu utilization of a node in percent. But sometimes values beyond 100.0% are being calculated. This is because a domain spend more time on a cpu than time is elapsed in the meantime.

A short explanation of the way how cpu utilization is computed in my case:

	1. - open two connections with
		conn_cur/conn_old = virConnectOpenReadOnly(NULL);
	2. - get current time
		gettimeofday(&time_old, NULL);
	   - get domain by id with
		dom_old = virDomainLookupByID(conn_old, id)
	   - get domain information
		virDomainGetInfo(dom_old, &info_old);
	3. - sleep a second
	
	4. - doing same stuff like in 2. but with _cur

	5. - compute cpu utilization by dividing used cputime by elapsed time
		and multiply with 100

Am I right if I suppose that cpuTime for _virDomainInfo structure will be directly acquired from the hypervisor in virDomainGetInfo (dom_old, &info_old) or is it already present with getting the domain itself? Is there any better solution of doing this, which is more precise?

And another general question:
The monitoring utility of xen, called xentop, provides also statistics about networking and vbds. Are there any plans to provide this values by libvirt in the future?

Cheers,

	Jan


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]