]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Add more information about regexps
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 11 Mar 2016 13:10:26 +0000 (13:10 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 11 Mar 2016 13:10:26 +0000 (13:10 +0000)
src/libserver/protocol.c
src/libserver/re_cache.c
src/libserver/re_cache.h

index 80d1f4cd0714f8956e601b6a8f1247761d8d6921..fe0a73fb7199a8238b80486fc01350941a339f05 100644 (file)
@@ -1019,9 +1019,12 @@ rspamd_protocol_http_reply (struct rspamd_http_message *msg,
                g_assert (restat != NULL);
                msg_info_task (
                                "regexp statistics: %ud pcre regexps scanned, %ud regexps matched,"
-                                               " %HL bytes scanned using pcre, %HL bytes scanned total",
+                               " %ud regexps total, %ud regexps cached,"
+                               " %HL bytes scanned using pcre, %HL bytes scanned total",
                                restat->regexp_checked,
                                restat->regexp_matched,
+                               restat->regexp_total,
+                               restat->regexp_fast_cached,
                                restat->bytes_scanned_pcre,
                                restat->bytes_scanned);
        }
index 8ab0cd0316e2ffd6e259f9288f07845489f28f73..b599a7085b61532040bbce21f9b672f6ee037b38 100644 (file)
@@ -438,6 +438,7 @@ rspamd_re_cache_runtime_new (struct rspamd_re_cache *cache)
        REF_RETAIN (cache);
        rt->checked = g_slice_alloc0 (NBYTES (cache->nre));
        rt->results = g_slice_alloc0 (cache->nre);
+       rt->stat.regexp_total = cache->nre;
 
        return rt;
 }
@@ -838,6 +839,7 @@ rspamd_re_cache_process (struct rspamd_task *task,
 
        if (isset (rt->checked, re_id)) {
                /* Fast path */
+               rt->stat.regexp_fast_cached ++;
                return rt->results[re_id];
        }
        else {
index 6c7999ba1762079f65791cef8f57bd1bd4fc44bd..b40788d3c06678b13826f18a0db4a700dcc581c4 100644 (file)
@@ -40,6 +40,8 @@ struct rspamd_re_cache_stat {
        guint64 bytes_scanned_pcre;
        guint regexp_checked;
        guint regexp_matched;
+       guint regexp_total;
+       guint regexp_fast_cached;
 };
 
 /**