Re: [PATCHv2 1/2] Add a new flag VIR_DOMAIN_CPU_STATS_VCPU to virDomainGetCPUStats

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

 



On Wed, May 02, 2012 at 01:43:03PM -0600, Eric Blake wrote:
> On 04/24/2012 03:20 AM, Hu Tao wrote:
> > Currently virDomainGetCPUStats gets total cpu usage, which consists
> > of:
> > 
> >   1. vcpu usage: the physical cpu time consumed by virtual cpu(s) of
> >      domain
> >   2. hypervisor: `total cpu usage' - `vcpu usage'
> > 
> > The flag VIR_DOMAIN_CPU_STATS_VCPU is for getting vcpu usages.
> > ---
> >  include/libvirt/libvirt.h.in |    8 ++++++++
> >  src/libvirt.c                |    9 +++++++--
> >  tools/virsh.c                |   16 +++++++++++-----
> >  3 files changed, 26 insertions(+), 7 deletions(-)
> 
> Question: is it better to make the user call virDomainGetCPUStats twice
> (once for total with flags==0, once for vcpu with flags=VCPU), where
> there is a race between the two calls?  Or should we instead return both

As Richard said, we already have had many two-stage-call APIs: one for
the size, another for the result. Do we also face the same race there?
Anyway, this is another story.

> counts in the same call, by having two separate virTypedParameter stat
> names and no flag?
> 
> In other words, I'm thinking it might be better to keep "cpu_time"
> (VIR_DOMAIN_CPU_STATS_CPUTIME) as the first stat, and add a second stat
> "vcpu_time" (VIR_DOMAIN_CPU_STATS_VCPUTIME) as a second stat, all within
> the same call, with no need to add a flag.

But I like this way because it seems more natural. See v4.

-- 
Thanks,
Hu Tao

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