[PATCH 1/6] virNodeGetMemoryStats: Expose new API

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

 



virNodeGetMemoryStats: Expose new API

Signed-off-by: Minoru Usui <usui@xxxxxxxxxxxxxxxxx>
---
 include/libvirt/libvirt.h.in |   65 +++++++++++++++++++++++++++++++++++++++++-
 src/libvirt_public.syms      |    1 +
 2 files changed, 65 insertions(+), 1 deletions(-)

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 7cd6e13..69e2255 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -280,6 +280,58 @@ struct _virNodeInfo {
     unsigned int threads;/* number of threads per core */
 };
 
+/**
+ * VIR_MEMORY_STATS_FIELD_LENGTH:
+ *
+ * Macro providing the field length of virMemoryStats
+ */
+#define VIR_MEMORY_STATS_FIELD_LENGTH 80
+
+/**
+ * VIR_MEMORY_STATS_TOTAL:
+ *
+ * Macro for the total memory: it represents the maximum memory.
+ */
+
+#define VIR_MEMORY_STATS_TOTAL "total"
+
+/**
+ * VIR_MEMORY_STATS_FREE:
+ *
+ * Macro for the free memory: On linux, it includes buffer and cached memory.
+ */
+
+#define VIR_MEMORY_STATS_FREE "free"
+
+/**
+ * VIR_MEMORY_STATS_BUFFERS:
+ *
+ * Macro for the buffer memory:
+ */
+
+#define VIR_MEMORY_STATS_BUFFERS "buffers"
+
+/**
+ * VIR_MEMORY_STATS_CACHED:
+ *
+ * Macro for the cached memory:
+ */
+
+#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.  */
 
@@ -565,6 +617,14 @@ int virDomainMigrateSetMaxSpeed(virDomainPtr domain,
 typedef virNodeInfo *virNodeInfoPtr;
 
 /**
+ * virMemoryStatsPtr:
+ *
+ * a virMemoryStatsPtr is a pointer to a virMemoryStats structure.
+ */
+
+typedef virMemoryStats *virMemoryStatsPtr;
+
+/**
  * virConnectFlags
  *
  * Flags when opening a connection to a hypervisor
@@ -697,7 +757,10 @@ int                     virConnectGetMaxVcpus   (virConnectPtr conn,
 int                     virNodeGetInfo          (virConnectPtr conn,
                                                  virNodeInfoPtr info);
 char *                  virConnectGetCapabilities (virConnectPtr conn);
-
+int                     virNodeGetMemoryStats(virConnectPtr conn,
+                                              virMemoryStatsPtr 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 0590535..277978e 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -442,6 +442,7 @@ LIBVIRT_0.9.2 {
         virDomainInjectNMI;
         virDomainScreenshot;
         virDomainSetSchedulerParametersFlags;
+	virNodeGetMemoryStats;
 } LIBVIRT_0.9.0;
 
 # .... define new API here using predicted next version number ....
-- 
1.7.1

--
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]