From f7bb8b73f04fcb3b4b815e956155e4f3df6eb486 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 4 Jun 2012 21:55:57 +0400 Subject: [PATCH] Print percents with actions in controller's 'stat' command output. --- src/controller.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/controller.c b/src/controller.c index d11edbfe6..1773fc447 100644 --- a/src/controller.c +++ b/src/controller.c @@ -400,8 +400,9 @@ process_stat_command (struct controller_session *session) r = rspamd_snprintf (out_buf, sizeof (out_buf), "Messages scanned: %ud" CRLF, session->worker->srv->stat->messages_scanned); if (session->worker->srv->stat->messages_scanned > 0) { for (i = METRIC_ACTION_REJECT; i <= METRIC_ACTION_NOACTION; i ++) { - r += rspamd_snprintf (out_buf + r, sizeof (out_buf) - r, "Messages with action %s: %ud" CRLF, - str_action_metric (i), session->worker->srv->stat->actions_stat[i]); + r += rspamd_snprintf (out_buf + r, sizeof (out_buf) - r, "Messages with action %s: %ud, %.2f%%" CRLF, + str_action_metric (i), session->worker->srv->stat->actions_stat[i], + (double)session->worker->srv->stat->actions_stat[i] / (double)session->worker->srv->stat->messages_scanned * 100.); if (i < METRIC_ACTION_GREYLIST) { spam += session->worker->srv->stat->actions_stat[i]; } -- 2.39.5