summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2011-02-08 12:30:06 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2011-03-01 15:14:07 +0000
commita31ff6fe648fc0d2425fc209703fecc36b74dd32 (patch)
treee2d2535e30ef3755d4a20b90a5020d93650f7bc0
parent17bed9d360aa8b0f871b5db3a0b3e1714a9ef3e4 (diff)
DBusList: add usage stats
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34040
-rw-r--r--dbus/dbus-list.c12
-rw-r--r--dbus/dbus-list.h7
2 files changed, 17 insertions, 2 deletions
diff --git a/dbus/dbus-list.c b/dbus/dbus-list.c
index 6a16ed60..d4d74f69 100644
--- a/dbus/dbus-list.c
+++ b/dbus/dbus-list.c
@@ -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
+
/** @} */
/**
diff --git a/dbus/dbus-list.h b/dbus/dbus-list.h
index 663ad257..2e346d5e 100644
--- a/dbus/dbus-list.h
+++ b/dbus/dbus-list.h
@@ -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 */