]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Improve ticks counting
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 17 Apr 2018 15:04:24 +0000 (16:04 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 17 Apr 2018 15:04:24 +0000 (16:04 +0100)
test/rspamd_radix_test.c

index 8e367f6d1b707abf5a24d82bf9bd5d9b272ce7f8..5a42b36e547a77e35c2a769bd6bf1fbc4e26f70c 100644 (file)
@@ -290,12 +290,14 @@ rspamd_radix_test_func (void)
        diff = (ts2 - ts1);
 
        msg_notice ("Added %hz elements in %.0f ticks", nelts, diff);
+       diff = 0;
 
-       ts1 = rspamd_get_ticks (TRUE);
        for (lc = 0; lc < lookup_cycles && all_good; lc ++) {
                for (i = 0; i < nelts / lookup_divisor; i ++) {
                        check = ottery_rand_range (nelts - 1);
 
+                       ts1 = rspamd_get_ticks (TRUE);
+
                        if (radix_find_compressed (comp_tree, addrs[check].addr6,
                                        sizeof (addrs[check].addr6))
                                        == RADIX_NO_VALUE) {
@@ -308,6 +310,9 @@ rspamd_radix_test_func (void)
                                                ipbuf,
                                                addrs[check].mask6);
                        }
+
+                       ts2 = rspamd_get_ticks (TRUE);
+                       diff += ts2 - ts1;
                }
        }
 #if 1
@@ -324,8 +329,6 @@ rspamd_radix_test_func (void)
 #endif
 
        g_assert (all_good);
-       ts2 = rspamd_get_ticks (TRUE);
-       diff = (ts2 - ts1);
 
        msg_notice ("Checked %hz elements in %.0f ticks",
                        nelts * lookup_cycles / lookup_divisor, diff);