[PATCH 3/6] virNodeGetCpuTime: Implement public API

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

 



virNodeGetCpuTime: Implement public API

---
 src/libvirt.c |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/src/libvirt.c b/src/libvirt.c
index 9bdb4c8..f3ef6ed 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -4260,6 +4260,44 @@ error:
 }
 
 /**
+ * virNodeGetCpuTime:
+ * @conn: pointer to the hypervisor connection
+ *
+ * provides the cumulative CPU time, when the Node booting up.
+ * Note: The CPU time used in nanoseconds.
+ *
+ * Returns 0 in case of success and -1 in case of failure.
+ */
+int
+virNodeGetCpuTime(virConnectPtr conn ATTRIBUTE_UNUSED,
+                  virNodeCpuTimePtr cpu_time)
+{
+    VIR_DEBUG("conn=%p", conn);
+
+    virResetLastError();
+
+    if (!VIR_IS_CONNECT (conn)) {
+        virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virDispatchError(NULL);
+        return 0;
+    }
+
+    if (conn->driver->nodeGetCpuTime) {
+        int ret;
+        ret = conn->driver->nodeGetCpuTime(conn, cpu_time);
+        if (ret < 0)
+            goto error;
+        return ret;
+    }
+
+    virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+
+error:
+    virDispatchError(conn);
+    return 0;
+}
+
+/**
  * virNodeGetFreeMemory:
  * @conn: pointer to the hypervisor connection
  *
-- 
1.7.1



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