aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-12-15 15:14:33 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-12-15 15:14:33 +0000
commitdab2e6f4be3f05374c9672026031c6534838beb1 (patch)
tree631d8182ba3ee4495c9024cb69b4478006c397d6 /utils
parent14deba94c8f582cf0df60409ff2d13d078cd4580 (diff)
downloadrspamd-dab2e6f4be3f05374c9672026031c6534838beb1.tar.gz
rspamd-dab2e6f4be3f05374c9672026031c6534838beb1.zip
[Minor] Add some timing for mime parsing tool
Diffstat (limited to 'utils')
-rw-r--r--utils/mime_tool.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/utils/mime_tool.c b/utils/mime_tool.c
index c2dde4fdd..fb4b7ee5e 100644
--- a/utils/mime_tool.c
+++ b/utils/mime_tool.c
@@ -23,6 +23,7 @@
#include "mime_parser.h"
#include "unix-std.h"
+static gdouble total_time = 0.0;
static void
rspamd_show_normal (struct rspamd_mime_part *part)
@@ -81,6 +82,7 @@ rspamd_process_file (struct rspamd_config *cfg, const gchar *fname, gint mode)
GError *err = NULL;
struct rspamd_mime_part *part;
guint i;
+ gdouble ts1, ts2;
fd = open (fname, O_RDONLY);
@@ -106,11 +108,16 @@ rspamd_process_file (struct rspamd_config *cfg, const gchar *fname, gint mode)
task->msg.begin = map;
task->msg.len = st.st_size;
+ ts1 = rspamd_get_ticks ();
+
if (!rspamd_mime_parse_task (task, &err)) {
rspamd_fprintf (stderr, "cannot parse %s: %e\n", fname, err);
g_error_free (err);
}
+ ts2 = rspamd_get_ticks ();
+ total_time += ts2 - ts1;
+
for (i = 0; i < task->parts->len; i ++) {
part = g_ptr_array_index (task->parts, i);
@@ -152,6 +159,8 @@ main (int argc, char **argv)
}
}
+ rspamd_printf ("Total time parsing: %.4f seconds\n", total_time);
+
rspamd_log_close (logger);
REF_RELEASE (cfg);