[libvirt] [PATCH 1/8] latency: Define new public API and structure

Daniel Veillard veillard at redhat.com
Fri Sep 2 10:06:53 UTC 2011


On Wed, Aug 31, 2011 at 04:26:06PM +0800, Osier Yang wrote:
> ---
>  include/libvirt/libvirt.h.in |  111 ++++++++++++++++++++++++++++++++++++++++++
>  src/libvirt_public.syms      |    5 ++
>  2 files changed, 116 insertions(+), 0 deletions(-)
> 
> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> index 53a2f7d..5474f63 100644
> --- a/include/libvirt/libvirt.h.in
> +++ b/include/libvirt/libvirt.h.in
> @@ -574,6 +574,112 @@ struct _virDomainBlockStats {
>   */
>  typedef virDomainBlockStatsStruct *virDomainBlockStatsPtr;
>  
> +
> +/**
> + * VIR_DOMAIN_BLOCK_STATS_FIELD_LENGTH:
> + *
> + * Macro providing the field length of virDomainBlockStatsFlagsStruct
> + */
> +#define VIR_DOMAIN_BLOCK_STATS_FIELD_LENGTH 80
> +
> +/**
> + * VIR_DOMAIN_BLOCK_STATS_READ_BYTES:
> + *
> + * Macro represents the total number of read bytes of the
> + * block device.
> + */
> +#define VIR_DOMAIN_BLOCK_STATS_READ_BYTES "rd_bytes"
> +
> +/**
> + * VIR_DOMAIN_BLOCK_STATS_READ_REQ:
> + *
> + * Macro represents the total read requests of the
> + * block device.
> + */
> +#define VIR_DOMAIN_BLOCK_STATS_READ_REQ "rd_operations"
> +
> +/**
> + * VIR_DOMAIN_BLOCK_STATS_READ_TOTAL_TIMES:
> + *
> + * Macro represents the total time spend on cache reads in
> + * nano-seconds of the block device.
> + */
> +#define VIR_DOMAIN_BLOCK_STATS_READ_TOTAL_TIMES "rd_total_times"
> +
> +/**
> + * VIR_DOMAIN_BLOCK_STATS_WRITE_BYTES:
> + *
> + * Macro represents the total number of write bytes of the
> + * block device.
> + */
> +#define VIR_DOMAIN_BLOCK_STATS_WRITE_BYTES "wr_bytes"
> +
> +/**
> + * VIR_DOMAIN_BLOCK_STATS_WRITE_REQ:
> + *
> + * Macro represents the total write requests of the
> + * block device.
> + */
> +#define VIR_DOMAIN_BLOCK_STATS_WRITE_REQ "wr_operations"
> +
> +/**
> + * VIR_DOMAIN_BLOCK_STATS_WRITE_TOTAL_TIMES:
> + *
> + * Macro represents the total time spend on cache writes in
> + * nano-seconds of the block device.
> + */
> +#define VIR_DOMAIN_BLOCK_STATS_WRITE_TOTAL_TIMES "wr_total_times"
> +
> +/**
> + * VIR_DOMAIN_BLOCK_STATS_FLUSH_REQ:
> + *
> + * Macro represents the total flush requests of the
> + * block device.
> + */
> +#define VIR_DOMAIN_BLOCK_STATS_FLUSH_REQ "flush_operations"
> +
> +/**
> + * VIR_DOMAIN_BLOCK_STATS_FLUSH_TOTAL_TIMES:
> + *
> + * Macro represents the total time spend on cache flushing in
> + * nano-seconds of the block device.
> + */
> +#define VIR_DOMAIN_BLOCK_STATS_FLUSH_TOTAL_TIMES "flush_total_times"
> +
> +/**
> + * VIR_DOMAIN_BLOCK_STATS_ERRS:
> + *
> + * In Xen this returns the mysterious 'oo_req'
> + */
> +#define VIR_DOMAIN_BLOCK_STATS_ERRS "errs"
> +
> +
> +/**
> + * virDomainBlockStatsFlagsStruct:
> + *
> + * Struct filled by virDomainBlockStatsFlags() providing information
> + * about the block device.
> + *
> + * Hypervisors may return a field set to ((long long)-1) which indicates
> + * that the hypervisor does not support that statistic.
> + *
> + * NB. Here 'long long' means 64 bit integer.
> + */
> +typedef struct _virDomainBlockStatsFlags virDomainBlockStatsFlagsStruct;
> +
> +struct _virDomainBlockStatsFlags {
> +    char field[VIR_DOMAIN_BLOCK_STATS_FIELD_LENGTH];
> +    long long value;
> +};
> +
> +/**
> + * virDomainBlockStatsFlagsPtr:
> + *
> + * A pointer to a virDomainBlockStatsFlagsStruct structure
> + */
> +typedef virDomainBlockStatsFlagsStruct *virDomainBlockStatsFlagsPtr;
> +
> +
>  /**
>   * virDomainInterfaceStats:
>   *
> @@ -1169,6 +1275,11 @@ int                     virDomainBlockStats     (virDomainPtr dom,
>                                                   const char *path,
>                                                   virDomainBlockStatsPtr stats,
>                                                   size_t size);
> +int                     virDomainBlockStatsFlags (virDomainPtr dom,
> +                                                  const char *path,
> +                                                  virDomainBlockStatsFlagsPtr params,
> +                                                  int *nparams,
> +                                                  unsigned int flags);
>  int                     virDomainInterfaceStats (virDomainPtr dom,
>                                                   const char *path,
>                                                   virDomainInterfaceStatsPtr stats,
> diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
> index c2b6666..61af4b5 100644
> --- a/src/libvirt_public.syms
> +++ b/src/libvirt_public.syms
> @@ -480,4 +480,9 @@ LIBVIRT_0.9.4 {
>          virDomainBlockPull;
>  } LIBVIRT_0.9.3;
>  
> +LIBVIRT_0.9.5 {
> +    global:
> +        virDomainBlockStatsFlags;
> +} LIBVIRT_0.9.4;
> +
>  # .... define new API here using predicted next version number ....
> -- 
> 1.7.6

 ACK for the API,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list