[libvirt] [PATCH] Fix formatting for virDomainGetCPUStats docstring

Peter Krempa pkrempa at redhat.com
Tue Jan 5 09:24:07 UTC 2016


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 at redhat.com>
> ---
>  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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160105/ba6bb530/attachment-0001.sig>


More information about the libvir-list mailing list