]> source.dussan.org Git - rspamd.git/commitdiff
* Change symbols planner sort logic to take into consideration not frequenses of...
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Wed, 26 Aug 2009 11:17:33 +0000 (15:17 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Wed, 26 Aug 2009 11:17:33 +0000 (15:17 +0400)
CMakeLists.txt
src/symbols_cache.c

index b78780bb35cead168ec83c40074e5c6f5eff0213..dbc49de28dbb7805af9d91c897a4a74e3d02f4b7 100644 (file)
@@ -524,3 +524,13 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
        INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory /var/run/rspamd/)")
        INSTALL(CODE "EXECUTE_PROCESS(COMMAND chown ${RSPAMD_USER}:${RSPAMD_GROUP} /var/run/rspamd/)")
 ENDIF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+
+# CPack section
+SET(CPACK_DEBIAN_PACKAGE_DEPENDS libevent1 libgmime-2.0-2a)
+SET(CPACK_PACKAGE_CONTACT "vsevolod@highsecure.ru")
+SET(CPACK_PACKAGE_NAME rspamd)
+SET(CPACK_SOURCE_IGNORE_FILES "\\\\.swp$" "/\\\\.hg/")
+SET(CPACK_PACKAGE_VERSION_MAJOR ${RSPAMD_VERSION_MAJOR})
+SET(CPACK_PACKAGE_VERSION_MINOR ${RSPAMD_VERSION_MINOR})
+SET(CPACK_PACKAGE_VERSION_PATCH ${RSPAMD_VERSION_PATCH})
+INCLUDE(CPack)
index 8ee23b7825b25a944ead9a467a91c6cae47bf4c9..d1aec71de3074a165a967897fa0bbf20894354fa 100644 (file)
@@ -31,7 +31,7 @@
 #include "cfg_file.h"
 
 #define WEIGHT_MULT 2.0
-#define FREQUENCY_MULT 1.0
+#define FREQUENCY_MULT 100.0
 #define TIME_MULT -1.0
 
 /* After which number of messages try to resort cache */
@@ -42,6 +42,8 @@
 
 #define MIN_CACHE 17
 
+uint64_t total_frequency;
+
 int
 cache_cmp (const void *p1, const void *p2)
 {
@@ -55,12 +57,17 @@ cache_logic_cmp (const void *p1, const void *p2)
 {
        const struct cache_item *i1 = p1, *i2 = p2;
        double w1, w2;
-
+       int f1 = 0, f2 = 0;
+       
+       if (total_frequency > 0) {
+               f1 = i1->s->frequency / total_frequency;
+               f2 = i2->s->frequency / total_frequency;
+       }
        w1 = abs (i1->s->weight) * WEIGHT_MULT +
-                i1->s->frequency * FREQUENCY_MULT + 
+                f1 * FREQUENCY_MULT + 
                 i1->s->avg_time * TIME_MULT;
        w2 = abs (i2->s->weight) * WEIGHT_MULT +
-                i2->s->frequency * FREQUENCY_MULT + 
+                f2 * FREQUENCY_MULT + 
                 i2->s->avg_time * TIME_MULT;
        
        return (int)w2 - w1;
@@ -105,6 +112,13 @@ get_mem_cksum (struct symbols_cache *cache)
 static void
 post_cache_init (struct symbols_cache *cache)
 {
+       int i;
+       
+       total_frequency = 0;
+       for (i = 0; i < cache->used_items; i ++) {
+               total_frequency += cache->items[i].s->frequency;
+       }
+
        qsort (cache->items, cache->used_items, sizeof (struct cache_item), cache_logic_cmp);
 }