Re: [PATCHv4 4/8] qemu: bulk stats: implement VCPU group

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

 



On 09/12/14 13:48, Francesco Romani wrote:
> This patch implements the VIR_DOMAIN_STATS_VCPU
> group of statistics.
> To do so, this patch also extracts a helper to gather the
> VCpu information.
> 
> Signed-off-by: Francesco Romani <fromani@xxxxxxxxxx>
> ---
>  include/libvirt/libvirt.h.in |   1 +
>  src/libvirt.c                |  12 +++
>  src/qemu/qemu_driver.c       | 200 +++++++++++++++++++++++++++++--------------
>  3 files changed, 149 insertions(+), 64 deletions(-)
> 

> @@ -17388,6 +17395,70 @@ qemuDomainGetStatsBalloon(virQEMUDriverPtr driver,
>      return 0;
>  }
>  
> +
> +static int
> +qemuDomainGetStatsVcpu(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
> +                       virDomainObjPtr dom,
> +                       virDomainStatsRecordPtr record,
> +                       int *maxparams,
> +                       unsigned int privflags ATTRIBUTE_UNUSED)
> +{
> +    size_t i;
> +    int ret = -1;
> +    char param_name[VIR_TYPED_PARAM_FIELD_LENGTH];
> +    virVcpuInfoPtr cpuinfo = NULL;
> +
> +    if (virTypedParamsAddUInt(&record->params,
> +                              &record->nparams,
> +                              maxparams,
> +                              "vcpu.current",
> +                              (unsigned) dom->def->vcpus) < 0)
> +        return -1;
> +
> +    if (virTypedParamsAddUInt(&record->params,
> +                              &record->nparams,
> +                              maxparams,
> +                              "vcpu.maximum",
> +                              (unsigned) dom->def->maxvcpus) < 0)
> +        return -1;
> +
> +    if (VIR_ALLOC_N(cpuinfo, dom->def->vcpus) < 0)
> +        return -1;
> +
> +    if (qemuDomainHelperGetVcpus(dom, cpuinfo, dom->def->vcpus,
> +                                 NULL, 0) < 0) {
> +        ret = 0; /* it's ok to be silent and go ahead */

virResetLastError() as the function would report one.

> +        goto cleanup;
> +    }
> +
> +    for (i = 0; i < dom->def->vcpus; i++) {
> +        snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
> +                 "vcpu.%u.state", cpuinfo[i].number);
> +        if (virTypedParamsAddInt(&record->params,
> +                                 &record->nparams,
> +                                 maxparams,
> +                                 param_name,
> +                                 cpuinfo[i].state) < 0)
> +            goto cleanup;
> +

ACK otherwise.

Peter


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]