From: Vsevolod Stakhov Date: Fri, 11 Mar 2016 13:10:26 +0000 (+0000) Subject: [Feature] Add more information about regexps X-Git-Tag: 1.2.0~71 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2236bd4b7c70fd5d288406a7e979c1643ff78ac3;p=rspamd.git [Feature] Add more information about regexps --- diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c index 80d1f4cd0..fe0a73fb7 100644 --- a/src/libserver/protocol.c +++ b/src/libserver/protocol.c @@ -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); } diff --git a/src/libserver/re_cache.c b/src/libserver/re_cache.c index 8ab0cd031..b599a7085 100644 --- a/src/libserver/re_cache.c +++ b/src/libserver/re_cache.c @@ -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 { diff --git a/src/libserver/re_cache.h b/src/libserver/re_cache.h index 6c7999ba1..b40788d3c 100644 --- a/src/libserver/re_cache.h +++ b/src/libserver/re_cache.h @@ -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; }; /**