mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 19:18:19 +00:00
Add debugging code to find FP inconsistency.
This commit is contained in:
parent
1b40412818
commit
c6f056caf2
1 changed files with 14 additions and 2 deletions
|
@ -11,6 +11,9 @@
|
||||||
|
|
||||||
#include "../util.h"
|
#include "../util.h"
|
||||||
|
|
||||||
|
// TODO: remove code within these ifdefs after debugging.
|
||||||
|
#define BLOOMFILTER_DEBUG
|
||||||
|
|
||||||
using namespace probabilistic;
|
using namespace probabilistic;
|
||||||
|
|
||||||
BloomFilter::BloomFilter()
|
BloomFilter::BloomFilter()
|
||||||
|
@ -144,8 +147,17 @@ void BasicBloomFilter::Add(const HashKey* key)
|
||||||
{
|
{
|
||||||
Hasher::digest_vector h = hasher->Hash(key);
|
Hasher::digest_vector h = hasher->Hash(key);
|
||||||
|
|
||||||
|
#ifdef BLOOMFILTER_DEBUG
|
||||||
|
for ( size_t i = 0; i < h.size(); ++i )
|
||||||
|
{
|
||||||
|
BitVector::size_type pos = h[i] % bits->Size();
|
||||||
|
fprintf(stderr, "setting bit %lu (was %u)\n", pos, !!(*bits)[pos]);
|
||||||
|
bits->Set(pos);
|
||||||
|
}
|
||||||
|
#else
|
||||||
for ( size_t i = 0; i < h.size(); ++i )
|
for ( size_t i = 0; i < h.size(); ++i )
|
||||||
bits->Set(h[i] % bits->Size());
|
bits->Set(h[i] % bits->Size());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t BasicBloomFilter::Count(const HashKey* key) const
|
size_t BasicBloomFilter::Count(const HashKey* key) const
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue