From 640b2981e165356ea0609a740cc3e937cf6ab6d5 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sun, 11 Jan 2009 18:53:27 +0300 Subject: [PATCH] * Implement statistic output in control interface --- src/controller.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/controller.c b/src/controller.c index 2115210e0..fb14cf8bb 100644 --- a/src/controller.c +++ b/src/controller.c @@ -161,9 +161,16 @@ process_command (struct controller_command *cmd, char **cmd_args, struct control } break; case COMMAND_STAT: - /* XXX need to implement stat */ if (check_auth (cmd, session)) { - r = snprintf (out_buf, sizeof (out_buf), "-- end of stats report" CRLF); + r = snprintf (out_buf, sizeof (out_buf), "Messages scanned: %u" CRLF, + session->worker->srv->stat->messages_scanned); + r += snprintf (out_buf + r, sizeof (out_buf) - r , "Messages learned: %u" CRLF, + session->worker->srv->stat->messages_learned); + r += snprintf (out_buf + r, sizeof (out_buf) - r, "Connections count: %u" CRLF, + session->worker->srv->stat->connections_count); + r += snprintf (out_buf + r, sizeof (out_buf) - r, "Control connections count: %u" CRLF, + session->worker->srv->stat->control_connections_count); + r += snprintf (out_buf + r, sizeof (out_buf) - r, "-- end of stats report" CRLF); bufferevent_write (session->bev, out_buf, r); } break; -- 2.39.5