[libvirt] [PATCH 07/12] [v2] virNodeGetMemoryStats: Expose new API
Daniel P. Berrange
berrange at redhat.com
Tue Jun 14 09:16:15 UTC 2011
On Tue, Jun 07, 2011 at 10:03:36AM +0900, Minoru Usui wrote:
> virNodeGetMemoryStats: Expose new API
>
> Signed-off-by: Minoru Usui <usui at mxm.nes.nec.co.jp>
> ---
> include/libvirt/libvirt.h.in | 78 ++++++++++++++++++++++++++++++++++++++++++
> src/libvirt_public.syms | 1 +
> 2 files changed, 79 insertions(+), 0 deletions(-)
>
> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> index 43e59a7..885db25 100644
> --- a/include/libvirt/libvirt.h.in
> +++ b/include/libvirt/libvirt.h.in
> @@ -339,6 +339,70 @@ struct _virCPUStats {
> unsigned long long value;
> };
>
> +/**
> + * VIR_MEMORY_STATS_FIELD_LENGTH:
> + *
> + * Macro providing the field length of virMemoryStats
> + */
> +#define VIR_MEMORY_STATS_FIELD_LENGTH 80
> +
> +/**
> + * VIR_MEMORY_STATS_ALL_CELLS:
> + *
> + * Macro for the total memory of all cells.
> + */
> +#define VIR_MEMORY_STATS_ALL_CELLS -1
> +
> +/**
> + * VIR_MEMORY_STATS_TOTAL:
> + *
> + * Macro for the total memory of specified cell:
> + * it represents the maximum memory.
> + */
> +
> +#define VIR_MEMORY_STATS_TOTAL "total"
> +
> +/**
> + * VIR_MEMORY_STATS_FREE:
> + *
> + * Macro for the free memory of specified cell:
> + * On linux, it includes buffer and cached memory, in case of
> + * VIR_MEMORY_STATS_ALL_CELLS.
> + */
> +
> +#define VIR_MEMORY_STATS_FREE "free"
> +
> +/**
> + * VIR_MEMORY_STATS_BUFFERS:
> + *
> + * Macro for the buffer memory: On linux, it only returns in case of
> + * VIR_MEMORY_STATS_ALL_CELLS.
> + */
> +
> +#define VIR_MEMORY_STATS_BUFFERS "buffers"
> +
> +/**
> + * VIR_MEMORY_STATS_CACHED:
> + *
> + * Macro for the cached memory: On linux, it only returns in case of
> + * VIR_MEMORY_STATS_ALL_CELLS.
> + */
> +
> +#define VIR_MEMORY_STATS_CACHED "cached"
> +
> +/**
> + * virMemoryStats:
> + *
> + * a virMemoryStats is a structure filled by virNodeGetMemoryStats()
> + * and providing the information of the memory of the Node.
> + */
> +
> +typedef struct _virMemoryStats virMemoryStats;
> +
> +struct _virMemoryStats {
> + char field[VIR_MEMORY_STATS_FIELD_LENGTH];
> + unsigned long long value;
> +};
>
> /* Common data types shared among interfaces with name/type/value lists. */
>
> @@ -611,6 +675,14 @@ typedef virNodeInfo *virNodeInfoPtr;
> typedef virCPUStats *virCPUStatsPtr;
>
> /**
> + * virMemoryStatsPtr:
> + *
> + * a virMemoryStatsPtr is a pointer to a virMemoryStats structure.
> + */
> +
> +typedef virMemoryStats *virMemoryStatsPtr;
> +
> +/**
> * virConnectFlags
> *
> * Flags when opening a connection to a hypervisor
> @@ -750,6 +822,12 @@ int virNodeGetCPUStats (virConnectPtr conn,
> int *nparams,
> unsigned int flags);
>
> +int virNodeGetMemoryStats (virConnectPtr conn,
> + int cellNum,
> + virCPUStatsPtr params,
> + int *nparams,
> + unsigned int flags);
> +
> unsigned long long virNodeGetFreeMemory (virConnectPtr conn);
>
> int virNodeGetSecurityModel (virConnectPtr conn,
> diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
> index 271b8e3..3aadc6f 100644
> --- a/src/libvirt_public.syms
> +++ b/src/libvirt_public.syms
> @@ -453,6 +453,7 @@ LIBVIRT_0.9.2 {
> LIBVIRT_0.9.3 {
> global:
> virNodeGetCPUStats;
> + virNodeGetMemoryStats;
> } LIBVIRT_0.9.2;
Indentation went wrong here, but ACK if that is fixed
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list