#ifdef DBUS_ENABLE_STATS
int peak_match_rules;
int peak_bus_names;
+ int peak_pending_replies;
#endif
int n_pending_unix_fds;
DBusTimeout *pending_unix_fds_timeout;
return FALSE;
}
+#ifdef DBUS_ENABLE_STATS
+ {
+ BusConnectionData *d;
+
+ d = BUS_CONNECTION_DATA (will_get_reply);
+ _dbus_assert (d != NULL);
+
+ update_peak(&d->peak_pending_replies, count);
+ }
+#endif
+
pending = dbus_new0 (BusPendingReply, 1);
if (pending == NULL)
{
return d->peak_bus_names;
}
+
+int bus_connection_get_n_pending_replies (DBusConnection *connection)
+{
+ BusConnectionData *d;
+ DBusList *link;
+ BusPendingReply *pending;
+ int count = 0;
+
+ d = BUS_CONNECTION_DATA (connection);
+ _dbus_assert(d != NULL);
+
+ link = bus_expire_list_get_first_link(d->connections->pending_replies);
+ while (link != NULL)
+ {
+ pending = link->data;
+ link = bus_expire_list_get_next_link(d->connections->pending_replies,
+ link);
+ if (pending->will_get_reply == connection)
+ ++count;
+ }
+
+ return count;
+}
+
+int
+bus_connection_get_peak_pending_replies (DBusConnection *connection)
+{
+ BusConnectionData *d;
+
+ d = BUS_CONNECTION_DATA (connection);
+ _dbus_assert (d != NULL);
+
+ return d->peak_pending_replies;
+}
#endif /* DBUS_ENABLE_STATS */
dbus_bool_t
int bus_connection_get_peak_match_rules (DBusConnection *connection);
int bus_connection_get_peak_bus_names (DBusConnection *connection);
+int bus_connection_get_n_pending_replies (DBusConnection *connection);
+int bus_connection_get_peak_pending_replies (DBusConnection *connection);
+
#endif /* BUS_CONNECTION_H */
!_dbus_asv_add_uint32 (&arr_iter, "PeakBusNames",
bus_connection_get_peak_bus_names (stats_connection)) ||
!_dbus_asv_add_string (&arr_iter, "UniqueName",
- bus_connection_get_name (stats_connection)))
+ bus_connection_get_name (stats_connection)) ||
+ !_dbus_asv_add_uint32 (&arr_iter, "PendingReplies",
+ bus_connection_get_n_pending_replies (stats_connection)) ||
+ !_dbus_asv_add_uint32 (&arr_iter, "PeakPendingReplies",
+ bus_connection_get_peak_pending_replies (stats_connection)))
{
_dbus_asv_abandon (&iter, &arr_iter);
goto oom;