aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/symcache
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2022-08-06 23:47:35 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2022-08-06 23:47:35 +0100
commit08516775de769867fd90da87c854597c9aa4f0a6 (patch)
treeda2cac74e12e6d0ba31870bb52e94ba1b2552953 /src/libserver/symcache
parent7d89519edd35bdc79fd295ef873ca607fe7700d9 (diff)
downloadrspamd-08516775de769867fd90da87c854597c9aa4f0a6.tar.gz
rspamd-08516775de769867fd90da87c854597c9aa4f0a6.zip
[Minor] Try to fix stats for the virtual symbols
Diffstat (limited to 'src/libserver/symcache')
-rw-r--r--src/libserver/symcache/symcache_c.cxx5
-rw-r--r--src/libserver/symcache/symcache_item.hxx11
2 files changed, 13 insertions, 3 deletions
diff --git a/src/libserver/symcache/symcache_c.cxx b/src/libserver/symcache/symcache_c.cxx
index d4ae88e67..76cac67b6 100644
--- a/src/libserver/symcache/symcache_c.cxx
+++ b/src/libserver/symcache/symcache_c.cxx
@@ -214,12 +214,13 @@ rspamd_symcache_start_refresh(struct rspamd_symcache *cache,
}
void
-rspamd_symcache_inc_frequency(struct rspamd_symcache *_cache, struct rspamd_symcache_item *item)
+rspamd_symcache_inc_frequency(struct rspamd_symcache *_cache, struct rspamd_symcache_item *item,
+ const char *sym_name)
{
auto *real_item = C_API_SYMCACHE_ITEM(item);
if (real_item) {
- real_item->inc_frequency();
+ real_item->inc_frequency(sym_name);
}
}
diff --git a/src/libserver/symcache/symcache_item.hxx b/src/libserver/symcache/symcache_item.hxx
index 94e3dc57d..8387cf523 100644
--- a/src/libserver/symcache/symcache_item.hxx
+++ b/src/libserver/symcache/symcache_item.hxx
@@ -343,8 +343,17 @@ public:
/**
* Increase frequency for a symbol
*/
- auto inc_frequency() -> void {
+ auto inc_frequency(const char *sym_name) -> void {
g_atomic_int_inc(&st->hits);
+
+ if (sym_name && symbol != sym_name && !is_virtual()) {
+ /* Likely a callback symbol with some virtual symbol that needs to be adjusted */
+ for (const auto &cld : get_children().value().get()) {
+ if (cld->get_name() == sym_name) {
+ cld->inc_frequency(sym_name);
+ }
+ }
+ }
}
/**