summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2011-02-08 15:48:12 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2011-03-01 15:14:07 +0000
commitdd30235ef2e63296fbfd6745dfff6279bd174fba (patch)
tree3a45e406e84f576f1600f2612a5b77b1abb7cc87
parent3729271b36ae366ada6af5f75db534361e0fd203 (diff)
Include size of link cache in per-connection statistics
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34040
-rw-r--r--bus/stats.c7
-rw-r--r--dbus/dbus-connection-internal.h3
-rw-r--r--dbus/dbus-connection.c8
3 files changed, 14 insertions, 4 deletions
diff --git a/bus/stats.c b/bus/stats.c
index 28fd49ba..4e728859 100644
--- a/bus/stats.c
+++ b/bus/stats.c
@@ -263,6 +263,7 @@ bus_stats_handle_get_connection_stats (DBusConnection *caller_connection,
static dbus_uint32_t stats_serial = 0;
dbus_uint32_t in_messages, in_bytes, in_fds, in_peak_bytes, in_peak_fds;
dbus_uint32_t out_messages, out_bytes, out_fds, out_peak_bytes, out_peak_fds;
+ dbus_uint32_t link_cache_bytes;
BusRegistry *registry;
BusService *service;
DBusConnection *stats_connection;
@@ -315,7 +316,8 @@ bus_stats_handle_get_connection_stats (DBusConnection *caller_connection,
&in_messages, &in_bytes, &in_fds,
&in_peak_bytes, &in_peak_fds,
&out_messages, &out_bytes, &out_fds,
- &out_peak_bytes, &out_peak_fds);
+ &out_peak_bytes, &out_peak_fds,
+ &link_cache_bytes);
if (!asv_add_uint32 (&iter, &arr_iter, "IncomingMessages", in_messages) ||
!asv_add_uint32 (&iter, &arr_iter, "IncomingBytes", in_bytes) ||
@@ -326,7 +328,8 @@ bus_stats_handle_get_connection_stats (DBusConnection *caller_connection,
!asv_add_uint32 (&iter, &arr_iter, "OutgoingBytes", out_bytes) ||
!asv_add_uint32 (&iter, &arr_iter, "OutgoingFDs", out_fds) ||
!asv_add_uint32 (&iter, &arr_iter, "PeakOutgoingBytes", out_peak_bytes) ||
- !asv_add_uint32 (&iter, &arr_iter, "PeakOutgoingFDs", out_peak_fds))
+ !asv_add_uint32 (&iter, &arr_iter, "PeakOutgoingFDs", out_peak_fds) ||
+ !asv_add_uint32 (&iter, &arr_iter, "LinkCacheBytes", link_cache_bytes))
goto oom;
/* end */
diff --git a/dbus/dbus-connection-internal.h b/dbus/dbus-connection-internal.h
index 3dc5989e..e55cb669 100644
--- a/dbus/dbus-connection-internal.h
+++ b/dbus/dbus-connection-internal.h
@@ -114,7 +114,8 @@ void _dbus_connection_get_stats (DBusConnection *connection,
dbus_uint32_t *out_bytes,
dbus_uint32_t *out_fds,
dbus_uint32_t *out_peak_bytes,
- dbus_uint32_t *out_peak_fds);
+ dbus_uint32_t *out_peak_fds,
+ dbus_uint32_t *link_cache_size);
/* This _dbus_bus_* stuff doesn't really belong here, but dbus-bus-internal.h seems
* silly for one function
diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c
index 7d5a8efc..59f5337b 100644
--- a/dbus/dbus-connection.c
+++ b/dbus/dbus-connection.c
@@ -6210,7 +6210,8 @@ _dbus_connection_get_stats (DBusConnection *connection,
dbus_uint32_t *out_bytes,
dbus_uint32_t *out_fds,
dbus_uint32_t *out_peak_bytes,
- dbus_uint32_t *out_peak_fds)
+ dbus_uint32_t *out_peak_fds,
+ dbus_uint32_t *link_cache_size)
{
CONNECTION_LOCK (connection);
@@ -6235,6 +6236,11 @@ _dbus_connection_get_stats (DBusConnection *connection,
if (out_peak_fds != NULL)
*out_peak_fds = _dbus_counter_get_peak_unix_fd_value (connection->outgoing_counter);
+ if (link_cache_size != NULL)
+ {
+ *link_cache_size = _dbus_list_get_length (&connection->link_cache) * sizeof (DBusList);
+ }
+
CONNECTION_UNLOCK (connection);
}
#endif /* DBUS_ENABLE_STATS */