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

[libvirt] [PATCHv2 1/6] virNodeGetCPUTime: Expose new API



virNodeGetCPUTime: Expose new API

Signed-off-by: Minoru Usui <usui mxm nes nec co jp>
---
 include/libvirt/libvirt.h.in |   64 ++++++++++++++++++++++++++++++++++++++++++
 src/libvirt_public.syms      |    5 +++
 2 files changed, 69 insertions(+), 0 deletions(-)

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index bd36015..154c138 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -228,6 +228,57 @@ struct _virNodeInfo {
     unsigned int threads;/* number of threads per core */
 };
 
+/**
+ * virNodeCpuTime:
+ *
+ * a virNodeCpuTime is a structure filled by virNodeGetCpuTime() and providing
+ * the information for the cpu time of the node.
+ */
+
+/**
+ * Cpu Time Statistics Tags:
+ */
+typedef enum {
+    /*
+     * The cumulative CPU time which spends by kernel,
+     * when the node booting up.(in nanoseconds).
+     */
+    VIR_NODE_CPU_TIME_KERNEL               = 0,
+    /*
+     * The cumulative CPU time which spends by user processes,
+     * when the node booting up.(in nanoseconds).
+     */
+    VIR_NODE_CPU_TIME_USER                 = 1,
+    /*
+     * The cumulative idle CPU time,
+     * when the node booting up.(in nanoseconds).
+     */
+    VIR_NODE_CPU_TIME_IDLE                 = 2,
+    /*
+     * The cumulative I/O wait CPU time,
+     * when the node booting up.(in nanoseconds).
+     */
+    VIR_NODE_CPU_TIME_IOWAIT               = 3,
+    /*
+     * The CPU utilization.
+     * The usage value is in percent and 100% represents all CPUs on
+     * the server.
+     */
+    VIR_NODE_CPU_TIME_UTILIZATION          = 4,
+
+    /*
+     * The number of statistics supported by this version of the interface.
+     * To add new statistics, add them to the enum and increase this value.
+     */
+    VIR_NODE_CPU_TIME_NR                   = 5,
+} virNodeCpuTimeTags;
+
+typedef struct _virNodeCpuTime virNodeCpuTime;
+
+struct _virNodeCpuTime {
+    virNodeCpuTimeTags tag;
+    unsigned long long val;
+};
 
 /**
  * virDomainSchedParameterType:
@@ -460,6 +511,14 @@ int virDomainMigrateSetMaxSpeed(virDomainPtr domain,
 typedef virNodeInfo *virNodeInfoPtr;
 
 /**
+ * virNodeCpuTimePtr:
+ *
+ * a virNodeCpuTimePtr is a pointer to a virNodeCpuTime structure.
+ */
+
+typedef virNodeCpuTime *virNodeCpuTimePtr;
+
+/**
  * virConnectFlags
  *
  * Flags when opening a connection to a hypervisor
@@ -593,6 +652,11 @@ int                     virNodeGetInfo          (virConnectPtr conn,
                                                  virNodeInfoPtr info);
 char *                  virConnectGetCapabilities (virConnectPtr conn);
 
+int                     virNodeGetCpuTime       (virConnectPtr conn,
+                                                 virNodeCpuTimePtr stats,
+                                                 unsigned int nr_stats,
+                                                 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 b4aed41..d292bdd 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -436,4 +436,9 @@ LIBVIRT_0.9.0 {
         virStorageVolUpload;
 } LIBVIRT_0.8.8;
 
+LIBVIRT_0.9.1 {
+    global:
+        virNodeGetCpuTime;
+} LIBVIRT_0.9.0;
+
 # .... define new API here using predicted next version number ....
-- 
1.7.1
-- 
Minoru Usui <usui mxm nes nec co jp>


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