[PATCHv4 1/6] virNodeGetCPUTimeParameters: Expose new API

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

 



virNodeGetCPUTimeParameters: Expose new API

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

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 1d6b276..84d8dc6 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -228,6 +228,58 @@ struct _virNodeInfo {
     unsigned int threads;/* number of threads per core */
 };
 
+/**
+ * VIR_CPU_TIME_FIELD_LENGTH:
+ *
+ * Macro providing the field length of virNodeCPUTimeParameters
+ */
+#define VIR_CPU_TIME_FIELD_LENGTH 80
+
+/**
+ * VIR_CPU_TIME_KERNEL:
+ *
+ * Macro for the cumulative CPU time which spends by kernel,
+ * when the node booting up.(in nanoseconds).
+ */
+#define VIR_CPU_TIME_KERNEL "kernel"
+
+/**
+ * The cumulative CPU time which spends by user processes,
+ * when the node booting up.(in nanoseconds).
+ */
+#define VIR_CPU_TIME_USER "user"
+
+/**
+ * The cumulative idle CPU time,
+ * when the node booting up.(in nanoseconds).
+ */
+#define VIR_CPU_TIME_IDLE "idle"
+
+/**
+ * The cumulative I/O wait CPU time,
+ * when the node booting up.(in nanoseconds).
+ */
+#define VIR_CPU_TIME_IOWAIT "iowait"
+
+/**
+ * The CPU utilization.
+ * The usage value is in percent and 100% represents all CPUs on
+ * the server.
+ */
+#define VIR_CPU_TIME_UTILIZATION "utilization"
+
+/**
+ * virCPUTimeParameter:
+ *
+ * a virNodeCPUTimeParameter is a structure filled by virNodeGetCPUTime()
+ * and providing the information for the cpu time of the node.
+ */
+typedef struct _virCPUTimeParameter virCPUTimeParameter;
+
+struct _virCPUTimeParameter {
+    char field[VIR_CPU_TIME_FIELD_LENGTH];
+    unsigned long long value;
+};
 
 /**
  * virDomainSchedParameterType:
@@ -460,6 +512,14 @@ int virDomainMigrateSetMaxSpeed(virDomainPtr domain,
 typedef virNodeInfo *virNodeInfoPtr;
 
 /**
+ * virCPUTimeParameterPtr:
+ *
+ * a virCPUTimeParameterPtr is a pointer to a virCPUTimeParameter structure.
+ */
+
+typedef virCPUTimeParameter *virCPUTimeParameterPtr;
+
+/**
  * virConnectFlags
  *
  * Flags when opening a connection to a hypervisor
@@ -593,6 +653,11 @@ int                     virNodeGetInfo          (virConnectPtr conn,
                                                  virNodeInfoPtr info);
 char *                  virConnectGetCapabilities (virConnectPtr conn);
 
+int                     virNodeGetCPUTimeParameters (virConnectPtr conn,
+                                                 virCPUTimeParameterPtr 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 a5a93ba..dd9cdec 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -440,6 +440,7 @@ LIBVIRT_0.9.2 {
     global:
         virDomainInjectNMI;
         virDomainScreenshot;
+        virNodeGetCPUTimeParameters;
 } LIBVIRT_0.9.0;
 
 # .... define new API here using predicted next version number ....
-- 
1.7.1

-- 
Minoru Usui <usui@xxxxxxxxxxxxxxxxx>

-- 
Minoru Usui <usui@xxxxxxxxxxxxxxxxx>

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