From 491f97c1466c610862bb01f80ab2473b912ed75c Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 8 Feb 2011 12:30:06 +0000 Subject: [PATCH 05/10] DBusList: add usage stats Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34040 --- dbus/dbus-list.c | 12 ++++++++++++ dbus/dbus-list.h | 7 +++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/dbus/dbus-list.c b/dbus/dbus-list.c index 6a16ed6..d4d74f6 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 663ad25..2e346d5 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 */ -- 1.7.2.3