Re: [PATCH 3/8] perf: implement the public APIs for perf event

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

 



> -----Original Message-----
> From: Jiri Denemark [mailto:jdenemar@xxxxxxxxxx]
> Sent: Tuesday, November 24, 2015 12:25 AM
> To: Ren, Qiaowei
> Cc: libvir-list@xxxxxxxxxx
> Subject: Re:  [PATCH 3/8] perf: implement the public APIs for perf event
> 
> On Tue, Nov 17, 2015 at 16:00:43 +0800, Qiaowei Ren wrote:
> > * src/libvirt-domain.c: Implement virDomainGetPerfEvents and
> > virDomainSetPerfEvents.
> >
> > Signed-off-by: Qiaowei Ren <qiaowei.ren@xxxxxxxxx>
> > ---
> >  src/libvirt-domain.c | 106
> > +++++++++++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 106 insertions(+)
> >
> > diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index
> > de7eb04..e767606 100644
> > --- a/src/libvirt-domain.c
> > +++ b/src/libvirt-domain.c
> > @@ -9572,6 +9572,112 @@ virDomainOpenChannel(virDomainPtr dom,
> >
> >
> >  /**
> > + * virDomainGetPerfEvents:
> > + * @domain: pointer to domain object
> > + * @params: pointer to perf events parameter object
> > + *          (return value, allocated by the caller)
> > + * @nparams: pointer to number of perf event parameters
> > + *
> > + * Get all perf events setting. On input, @nparams gives the size of
> > + the
> > + * @params array; on output, @nparams gives how many slots were
> > + filled
> > + * with parameter information, which might be less but will not
> > + exceed
> > + * the input value.
> > + *
> > + * As a special case, calling with @params as NULL and @nparams as 0
> > + on
> > + * input will cause @nparams on output to contain the number of
> > + parameters
> > + * supported by the hypervisor. The caller should then allocate
> > + @params
> > + * array, i.e. (sizeof(@virTypedParameter) * @nparams) bytes and call
> > + the
> > + * API again.
> > + *
> > + * See virDomainGetMemoryParameters() for an equivalent usage example.
> 
> You took a wrong API to copy. Requiring the caller to run the API with @params
> == NULL to get the number of parameters and then pass the allocated @params
> to get the values is the original design which we do not use for new APIs. The
> API should just allocate @params, fill it with all the values it knows about, and
> return the count in @nparams. In other words, no caller allocated arrays, please.
> You can look at, e.g., virDomainGetJobStats to see how it works.
> 

Thanks, Jirka. I will update this patch according to new API design.

Thanks,
Qiaowei

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