[libvirt] [PATCHv3 4/8] qemu: bulk stats: implement VCPU group

Peter Krempa pkrempa at redhat.com
Tue Sep 9 11:56:09 UTC 2014


On 09/08/14 15:05, 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 at redhat.com>
> ---
>  include/libvirt/libvirt.h.in |   1 +
>  src/libvirt.c                |  13 +++
>  src/qemu/qemu_driver.c       | 210 ++++++++++++++++++++++++++++++-------------
>  3 files changed, 160 insertions(+), 64 deletions(-)
> 
> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> index 1e4e428..68573a0 100644
> --- a/include/libvirt/libvirt.h.in
> +++ b/include/libvirt/libvirt.h.in
> @@ -2513,6 +2513,7 @@ typedef enum {
>      VIR_DOMAIN_STATS_STATE = (1 << 0), /* return domain state */
>      VIR_DOMAIN_STATS_CPU_TOTAL = (1 << 1), /* return domain CPU info */
>      VIR_DOMAIN_STATS_BALLOON = (1 << 2), /* return domain balloon info */
> +    VIR_DOMAIN_STATS_VCPU = (1 << 3), /* return domain virtual CPU info */
>  } virDomainStatsTypes;
>  
>  typedef enum {
> diff --git a/src/libvirt.c b/src/libvirt.c
> index f21eb39..0326847 100644
> --- a/src/libvirt.c
> +++ b/src/libvirt.c
> @@ -21569,6 +21569,19 @@ virConnectGetDomainCapabilities(virConnectPtr conn,
>   * "balloon.maximum" - the maximum memory in kiB allowed
>   *                     as unsigned long long.
>   *
> + * VIR_DOMAIN_STATS_VCPU: Return virtual CPU statistics.
> + * Due to VCPU hotplug, the vcpu.<num>.* array could be sparse.
> + * The actual size of the array correspond to "vcpu.current".
> + * The array size will never exceed "vcpu.maximum".
> + * The typed parameter keys are in this format:
> + * "vcpu.current" - current number of online virtual CPUs as unsigned int.
> + * "vcpu.maximum" - maximum number of online virtual CPUs as unsigned int.
> + * "vcpu.<num>.state" - state of the virtual CPU <num>, as int
> + *                      from virVcpuState enum.
> + * "vcpu.<num>.time" - virtual cpu time spent by virtual CPU <num>
> + *                     as unsigned long long.
> + * "vcpu.<num>.cpu" - physical CPU pinned to virtual CPU <num> as int.

This is not the CPU number the vCPU is pinned to but rather the current
CPU number where the vCPU is actually running. If you pin it to multiple
CPUs this may change in the range of the host CPUs the vCPU is pinned
to. Said this I don't think this is an useful stat.

Rather than this I'd like to see the mask of the host CPUs where this
vCPU is pinned to. (returned as a human readable bitmask string).

Any thoughts?

> + *
>   * Using 0 for @stats returns all stats groups supported by the given
>   * hypervisor.
>   *
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 4f8ccac..6bcbfb5 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c

Otherwise looks good.

Peter

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140909/6198f5ba/attachment-0001.sig>


More information about the libvir-list mailing list