Re: [PATCH] bhyve: implement domainGetCPUStats

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

 



On 04/30/2014 12:03 PM, Daniel P. Berrange wrote:
> On Tue, Apr 29, 2014 at 08:54:26PM +0400, Roman Bogorodskiy wrote:
>>
>> Looks like FreeBSD does not support such kind of per-cpu reporting for
>> host cpus. Just to make sure I didn't miss something, I asked that
>> question of the FreeBSD virtualization maillist and looks like I'm right
>> about that [1].
>>
>> Would it better to abandon this feature for now and wait when it'd be
>> supported (I'm not sure if/when it's going to happen), or just leave the
>> code that reports only the stats for all cpus?
> 
> I think it is better to leave it unsupported, so apps can see the
> VIR_ERR_NO_SUPPORT error and not mistakenly interpret incorrect data.
> 

The apps should check how many stat parameters are supported for a given pCPU
by calling virDomainGetCPUStats with nparams=0 and/or check the actual number
of stats returned.

Could we return valid results for total CPU stats (start_cpu = -1) and just
not return any for all other start_cpu values?

From the API documentation [1]:

 * Typical use sequence is below.
 *
 * getting total stats: set start_cpu as -1, ncpus 1
 * virDomainGetCPUStats(dom, NULL, 0, -1, 1, 0) => nparams
 * params = calloc(nparams, sizeof(virTypedParameter))
 * virDomainGetCPUStats(dom, params, nparams, -1, 1, 0) => total stats.
 *
 * getting per-cpu stats:
 * virDomainGetCPUStats(dom, NULL, 0, 0, 0, 0) => ncpus
 * virDomainGetCPUStats(dom, NULL, 0, 0, 1, 0) => nparams
 * params = calloc(ncpus * nparams, sizeof(virTypedParameter))
 * virDomainGetCPUStats(dom, params, nparams, 0, ncpus, 0) => per-cpu stats

Jan

[1] http://libvirt.org/html/libvirt-libvirt.html#virDomainGetCPUStats

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[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]