Re: [PATCH] Fix formatting for virDomainGetCPUStats docstring

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

 



On Tue, Jan 05, 2016 at 08:59:11 +0100, Martin Kletzander wrote:
> We have few code samples there that are almost unreadable when formatted
> because they are not indented properly.  By indenting them they are
> formatted as code and hence quite readable.  Also adjust descriptions to
> be comments and add semicolons so that the code sample looks like sample
> of a working code.
> 
> Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
> ---
>  src/libvirt-domain.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
> index b91388e77e00..970b0db0f23c 100644
> --- a/src/libvirt-domain.c
> +++ b/src/libvirt-domain.c
> @@ -10572,15 +10572,17 @@ virDomainGetBlockIoTune(virDomainPtr dom,
>   * 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.
> + *
> + *   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
> + *
> + *   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
>   *
>   * Returns -1 on failure, or the number of statistics that were
>   * populated per cpu on success (this will be less than the total

ACK, It might be worth noting that the functions are now obsolete in
favor of the bulk stats API. (as you can see the use semantics of
virDomainGetCPUStats is terrible needing two dummy calls for one that
actually retrieves data).

Peter

Attachment: signature.asc
Description: 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]