DBusList: add usage stats
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Tue, 8 Feb 2011 12:30:06 +0000 (12:30 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Fri, 24 Jun 2011 15:01:02 +0000 (16:01 +0100)
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34040

dbus/dbus-list.c
dbus/dbus-list.h

index 6a16ed6..d4d74f6 100644 (file)
@@ -146,6 +146,18 @@ link_after (DBusList **list,
     }
 }
 
+#ifdef DBUS_ENABLE_STATS
+void
+_dbus_list_get_stats     (dbus_uint32_t *in_use_p,
+                          dbus_uint32_t *in_free_list_p,
+                          dbus_uint32_t *allocated_p)
+{
+  _DBUS_LOCK (list);
+  _dbus_mem_pool_get_stats (list_pool, in_use_p, in_free_list_p, allocated_p);
+  _DBUS_UNLOCK (list);
+}
+#endif
+
 /** @} */
 
 /**
index 663ad25..2e346d5 100644 (file)
@@ -84,8 +84,6 @@ void        _dbus_list_prepend_link       (DBusList **list,
 dbus_bool_t _dbus_list_length_is_one      (DBusList **list);
 
 
-
-
 void _dbus_list_foreach (DBusList            **list,
                          DBusForeachFunction   function,
                          void                 *data);
@@ -93,6 +91,11 @@ void _dbus_list_foreach (DBusList            **list,
 #define _dbus_list_get_next_link(list, link) ((link)->next == *(list) ? NULL : (link)->next)
 #define _dbus_list_get_prev_link(list, link) ((link) == *(list) ? NULL : (link)->prev)
 
+/* if DBUS_ENABLE_STATS */
+void        _dbus_list_get_stats          (dbus_uint32_t *in_use_p,
+                                           dbus_uint32_t *in_free_list_p,
+                                           dbus_uint32_t *allocated_p);
+
 DBUS_END_DECLS
 
 #endif /* DBUS_LIST_H */