diff lxcstats.h @ 7:8339ab15527d

Add running/stopped containers global statistics and refactor some things
author Louis Opter <louis@dotcloud.com>
date Sat, 01 Jan 2011 17:46:40 +0100
parents 2cb8a6cbe468
children 6f2e13f5fcfd
line wrap: on
line diff
--- a/lxcstats.h	Sat Jan 01 16:18:17 2011 +0100
+++ b/lxcstats.h	Sat Jan 01 17:46:40 2011 +0100
@@ -27,8 +27,8 @@
  * Note: see how lxc-info gets these infos.
  */
 struct          lxcst_globals {
-    uint32_t    running_containers;
-    uint32_t    stopped_containers;
+    uint16_t    running_containers;
+    uint16_t    stopped_containers;
 };
 
 /**
@@ -51,7 +51,10 @@
 int             lxcst_close(lxcst_handle *hdl);
 
 /**
- * @brief Collect statistic on all containers.
+ * @brief Collect statistics on all containers.
+ *
+ * Walk the cgroup pseudo filesystem and get statistics for all found
+ * containers. Also refresh the global statistics struture.
  *
  * @param [in] hdl The pointer returned by lxcst_handle.
  * @param [in] cb A function pointer to a callback which takes a pointer to an
@@ -61,7 +64,20 @@
  * lxcst_span_containers stops and return with -1 with errno set to EINTR.
  *
  * @return 0 on success, -1 on error with errno set.
+ *
+ * @see lxcst_globals_statistics
+ * @see struct lxcst
  */
 int             lxcst_span_containers(lxcst_handle *hdl, int (*cb)(void *, const struct lxcst *), void *ctx);
 
+/**
+ * @brief Get a copy of the global LXC statistics object.
+ *
+ * @param [out] sb A pointer to a struct lxcst_globals.
+ *
+ * @see struct lxcst_globals
+ * @see lxcst_span_containers
+ */
+void            lxcst_globals_statistics(struct lxcst_globals *sb);
+
 #endif