]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virNodeGetCPUStats: Expose new API
authorMinoru Usui <usui@mxm.nes.nec.co.jp>
Tue, 7 Jun 2011 00:58:47 +0000 (09:58 +0900)
committerEric Blake <eblake@redhat.com>
Tue, 14 Jun 2011 20:48:45 +0000 (14:48 -0600)
Signed-off-by: Minoru Usui <usui@mxm.nes.nec.co.jp>
include/libvirt/libvirt.h.in
python/generator.py
src/libvirt_public.syms

index 8b63ba2183e1b5184b3748b0a478bfb7f4cb85e8..4bd2cdcd4644ff20082312a19bb3a017289d3bd6 100644 (file)
@@ -216,7 +216,6 @@ typedef struct _virStream virStream;
  */
 typedef virStream *virStreamPtr;
 
-
 /**
  * VIR_SECURITY_LABEL_BUFLEN:
  *
@@ -302,6 +301,66 @@ struct _virNodeInfo {
     unsigned int threads;/* number of threads per core */
 };
 
+/**
+ * VIR_CPU_STATS_FIELD_LENGTH:
+ *
+ * Macro providing the field length of virNodeCPUStats
+ */
+#define VIR_CPU_STATS_FIELD_LENGTH 80
+
+/**
+ * VIR_CPU_STATS_ALL_CPUS:
+ *
+ * Macro for the total CPU time/utilization
+ */
+#define VIR_CPU_STATS_ALL_CPUS (-1)
+
+/**
+ * VIR_CPU_STATS_KERNEL:
+ *
+ * Macro for the cumulative CPU time which spends by kernel,
+ * when the node booting up.(in nanoseconds).
+ */
+#define VIR_CPU_STATS_KERNEL "kernel"
+
+/**
+ * The cumulative CPU time which spends by user processes,
+ * when the node booting up.(in nanoseconds).
+ */
+#define VIR_CPU_STATS_USER "user"
+
+/**
+ * The cumulative idle CPU time,
+ * when the node booting up.(in nanoseconds).
+ */
+#define VIR_CPU_STATS_IDLE "idle"
+
+/**
+ * The cumulative I/O wait CPU time,
+ * when the node booting up.(in nanoseconds).
+ */
+#define VIR_CPU_STATS_IOWAIT "iowait"
+
+/**
+ * The CPU utilization.
+ * The usage value is in percent and 100% represents all CPUs on
+ * the server.
+ */
+#define VIR_CPU_STATS_UTILIZATION "utilization"
+
+/**
+ * virCPUStats:
+ *
+ * a virNodeCPUStats is a structure filled by virNodeGetCPUStats()
+ * and providing the information for the cpu stats of the node.
+ */
+typedef struct _virCPUStats virCPUStats;
+
+struct _virCPUStats {
+    char field[VIR_CPU_STATS_FIELD_LENGTH];
+    unsigned long long value;
+};
+
 
 /* Common data types shared among interfaces with name/type/value lists.  */
 
@@ -561,6 +620,14 @@ int virDomainMigrateSetMaxSpeed(virDomainPtr domain,
 
 typedef virNodeInfo *virNodeInfoPtr;
 
+/**
+ * virCPUStatsPtr:
+ *
+ * a virCPUStatsPtr is a pointer to a virCPUStats structure.
+ */
+
+typedef virCPUStats *virCPUStatsPtr;
+
 /**
  * virConnectFlags
  *
@@ -695,6 +762,12 @@ int                     virNodeGetInfo          (virConnectPtr conn,
                                                  virNodeInfoPtr info);
 char *                  virConnectGetCapabilities (virConnectPtr conn);
 
+int                     virNodeGetCPUStats (virConnectPtr conn,
+                                            int cpuNum,
+                                            virCPUStatsPtr params,
+                                            int *nparams,
+                                            unsigned int flags);
+
 unsigned long long      virNodeGetFreeMemory    (virConnectPtr conn);
 
 int                     virNodeGetSecurityModel (virConnectPtr conn,
index 634b78877f83da7395cbd0eb22ee8cee0d47bf23..d929efa42eb05ca38cc833dc79b27c13d35ee788 100755 (executable)
@@ -363,6 +363,7 @@ skip_impl = (
     'virConnectBaselineCPU',
     'virDomainRevertToSnapshot',
     'virDomainSendKey',
+    'virNodeGetCPUStats',
 )
 
 
index a7be36bb789e57377534d9366acdff6ac78815b3..af559b6366c09aa6c40063bd1b371163d0863472 100644 (file)
@@ -454,6 +454,7 @@ LIBVIRT_0.9.3 {
     global:
         virDomainPinVcpuFlags;
         virDomainSendKey;
+        virNodeGetCPUStats;
 } LIBVIRT_0.9.2;
 
 # .... define new API here using predicted next version number ....