summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsanghyeok.oh <sanghyeok.oh@samsung.com>2020-05-20 16:32:23 +0900
committersanghyeok.oh <sanghyeok.oh@samsung.com>2020-05-22 15:15:07 +0900
commit73a3cf6d05ed26c5c62eb22ffa9146bdca446358 (patch)
treeaacbeaae8174d9af102a840a21f9b4c91735f331
parent09b3f42114e5ff61b8bd2fb10862eb8fff7b4f97 (diff)
downloaddbus-73a3cf6d05ed26c5c62eb22ffa9146bdca446358.tar.gz
dbus-73a3cf6d05ed26c5c62eb22ffa9146bdca446358.tar.bz2
dbus-73a3cf6d05ed26c5c62eb22ffa9146bdca446358.zip
Stats: Add field PendingReplies
Pending replies will increasing 1) if client sending lots of messages to destination at once 2) if server eats incoming messages.(no reply) In case of 2) dbus-daemon still has pending information. With default bus context option (reply_timeout=-1) it never freed. Assuming 2) happended repeatedly, then it is hard to detect until it exceeds maximum pending replies limit, because of dbus-daemon print warning messages only if pending replies over bus limit(default 1024 for system bus). Change-Id: Iee0515fac68af7586547cc5ef5e6fa73d388a312 Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
-rw-r--r--bus/connection.c46
-rw-r--r--bus/connection.h3
-rw-r--r--bus/stats.c6
3 files changed, 54 insertions, 1 deletions
diff --git a/bus/connection.c b/bus/connection.c
index e1802e7d..851fb1b7 100644
--- a/bus/connection.c
+++ b/bus/connection.c
@@ -118,6 +118,7 @@ typedef struct
#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;
@@ -2041,6 +2042,17 @@ bus_connections_expect_reply (BusConnections *connections,
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)
{
@@ -2965,6 +2977,40 @@ bus_connection_get_peak_bus_names (DBusConnection *connection)
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
diff --git a/bus/connection.h b/bus/connection.h
index ba7ce2f3..868508ab 100644
--- a/bus/connection.h
+++ b/bus/connection.h
@@ -194,4 +194,7 @@ int bus_connections_get_peak_bus_names_per_conn (BusConnections *connections);
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 */
diff --git a/bus/stats.c b/bus/stats.c
index 27422352..367d9c17 100644
--- a/bus/stats.c
+++ b/bus/stats.c
@@ -170,7 +170,11 @@ bus_stats_handle_get_connection_stats (DBusConnection *caller_connection,
!_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;