src/util/bitset/stress_test/stress.cpp File Reference

#include <ncbi_pch.hpp>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <memory.h>
#include <iostream>
#include <time.h>
#include <util/bitset/bm.h>
#include <util/bitset/bmalgo.h>
#include <util/bitset/bmserial.h>
#include <util/bitset/bitset_debug.hpp>
#include "rlebtv.h"
#include <util/bitset/encoding.h>
#include <limits.h>

Include dependency graph for stress.cpp:

Go to the source code of this file.

Classes

class  pool_block_allocator
class  pool_ptr_allocator

Defines

#define POOL_SIZE   5000

Typedefs

typedef bm::bvector bvect
typedef bm::bvector_mini<
bm::block_allocator
bvect_mini

Functions

template<class T>
T * pool_allocate (T **pool, int &i, size_t n)
void * pool_allocate2 (void **pool, int &i, size_t n)
template<class T>
void pool_free (T **pool, int &i, T *p)
void CheckVectors (bvect_mini &bvect_min, bvect &bvect_full, unsigned size, bool detailed=false)
unsigned random_minmax (unsigned min, unsigned max)
void FillSets (bvect_mini *bvect_min, bvect *bvect_full, unsigned min, unsigned max, unsigned fill_factor)
void FillSetsIntervals (bvect_mini *bvect_min, bvect *bvect_full, unsigned min, unsigned max, unsigned fill_factor, bool set_flag=true)
void FillSetClearIntervals (bvect_mini *bvect_min, bvect *bvect_full, unsigned min, unsigned max, unsigned fill_factor)
void FillSetsRandom (bvect_mini *bvect_min, bvect *bvect_full, unsigned min, unsigned max, unsigned fill_factor)
void FillSetsRandomMethod (bvect_mini *bvect_min, bvect *bvect_full, unsigned min, unsigned max, int optimize=0, int method=-1)
unsigned SerializationOperation (bvect *bv_target, bvect &bv1, bvect &bv2, set_operation op, bool check_reverse=false)
void SerializationOperation2Test (bvect *bv_target, bvect &bv1, bvect &bv2, unsigned predicted_count, set_operation op_count, set_operation op_combine)
void print_mv (const bvect_mini &bvect_min, unsigned size)
void print_gap (const gap_vector &gap_vect, unsigned size)
void CheckGAPMin (const gap_vector &gapv, const bvect_mini &bvect_min, unsigned len)
void CheckIntervals (const bvect &bv, unsigned max_bit)
template<class T>
void CheckCountRange (const T &vect, unsigned left, unsigned right, unsigned *block_count_arr=0)
unsigned BitCountChange (unsigned word)
void DetailedCheckVectors (const bvect_mini &bvect_min, const bvect &bvect_full, unsigned size)
void ClearAllTest ()
void WordCmpTest ()
void BasicFunctionalityTest ()
void SimpleRandomFillTest ()
void RangeRandomFillTest ()
void AndOperationsTest ()
void OrOperationsTest ()
void SubOperationsTest ()
void XorOperationsTest ()
void ComparisonTest ()
void DesrializationTest2 ()
void StressTest (int repetitions)
void GAPCheck ()
void MutationTest ()
void MutationOperationsTest ()
void SerializationTest ()
void GetNextTest ()
void MaxSTest ()
void CalcBeginMask ()
void CalcEndMask ()
void EnumeratorTest ()
void BlockLevelTest ()
void SyntaxTest ()
void SetTest ()
template<class A, class B>
void CompareMiniSet (const A &ms, const B &bvm)
void MiniSetTest ()
unsigned CalcBitCount32 (unsigned b)
void PrintGapLevels (const gap_word_t *glevel)
void OptimGAPTest ()
void BitCountChangeTest ()
void ResizeTest ()
void ExportTest ()
void TestRecomb ()
int main (void)

Variables

const unsigned BITVECT_SIZE = 100000000 * 2
const unsigned ITERATIONS = 100000
const unsigned PROGRESS_PRINT = 2000000


Define Documentation

#define POOL_SIZE   5000
 

Definition at line 57 of file stress.cpp.

Referenced by pool_free().


Typedef Documentation

typedef bm::bvector bvect
 

Definition at line 318 of file stress.cpp.

typedef bm::bvector_mini<bm::block_allocator> bvect_mini
 

Definition at line 319 of file stress.cpp.


Function Documentation

void AndOperationsTest  ) 
 

Definition at line 1486 of file stress.cpp.

References bm::any_and(), bm::bvector< Alloc, MS >::bit_and(), bm::BM_GAP, CheckCountRange(), CheckVectors(), bm::bvector_mini< A >::combine_and(), bm::bvector< Alloc, MS >::count(), bm::count_and(), SerializationOperation2Test(), bm::set_AND, bm::bvector< Alloc, MS >::set_bit(), bm::bvector_mini< A >::set_bit(), bm::set_COUNT_AND, and bm::bvector< Alloc, MS >::set_new_blocks_strat().

Referenced by main().

void BasicFunctionalityTest  ) 
 

Definition at line 1228 of file stress.cpp.

References bm::bvector< Alloc, MS >::set_bit(), and bm::bvector_mini< A >::set_bit().

Referenced by main().

unsigned BitCountChange unsigned  word  ) 
 

Definition at line 981 of file stress.cpp.

References bm::bvector< Alloc, MS >::count().

Referenced by BitCountChangeTest().

void BitCountChangeTest  ) 
 

Definition at line 5890 of file stress.cpp.

References bm::bit_count_change(), and BitCountChange().

Referenced by main().

void BlockLevelTest  ) 
 

Definition at line 5355 of file stress.cpp.

References bm::BM_GAP, bm::bvector< Alloc, MS >::set_bit(), and bm::bvector< Alloc, MS >::set_new_blocks_strat().

Referenced by main().

void CalcBeginMask  ) 
 

Definition at line 5108 of file stress.cpp.

References mask, and bm::set_word_mask.

Referenced by main().

unsigned CalcBitCount32 unsigned  b  ) 
 

Definition at line 5807 of file stress.cpp.

void CalcEndMask  ) 
 

Definition at line 5132 of file stress.cpp.

References mask, and bm::set_word_mask.

Referenced by main().

template<class T>
void CheckCountRange const T &  vect,
unsigned  left,
unsigned  right,
unsigned *  block_count_arr = 0
 

Definition at line 953 of file stress.cpp.

Referenced by AndOperationsTest(), OrOperationsTest(), RangeRandomFillTest(), SimpleRandomFillTest(), SubOperationsTest(), and XorOperationsTest().

void CheckGAPMin const gap_vector gapv,
const bvect_mini bvect_min,
unsigned  len
 

Definition at line 919 of file stress.cpp.

References bm::bvector_mini< A >::is_bit_true(), and gap_vector::is_bit_true().

void CheckIntervals const bvect bv,
unsigned  max_bit
 

Definition at line 934 of file stress.cpp.

References bm::count_intervals(), and bm::bvector< Alloc, MS >::test().

void CheckVectors bvect_mini bvect_min,
bvect bvect_full,
unsigned  size,
bool  detailed = false
 

Definition at line 1040 of file stress.cpp.

References bm::bvector< Alloc, MS >::any(), bm::bvector_mini< A >::bit_count(), bm::bvector< Alloc, MS >::count(), DetailedCheckVectors(), bm::bvector< Alloc, MS >::first(), bm::bvector< Alloc, MS >::get_bit(), bm::bvector< Alloc, MS >::get_first(), bm::bvector_mini< A >::get_first(), bm::bvector< Alloc, MS >::get_next(), bm::bvector_mini< A >::get_next(), bm::bvector_mini< A >::is_bit_true(), and bm::bvector< Alloc, MS >::recalc_count().

Referenced by AndOperationsTest(), MutationOperationsTest(), MutationTest(), OrOperationsTest(), RangeRandomFillTest(), SerializationTest(), SimpleRandomFillTest(), SubOperationsTest(), and XorOperationsTest().

void ClearAllTest  ) 
 

Definition at line 1161 of file stress.cpp.

References bm::bvector< Alloc, MS >::set_bit().

Referenced by main().

template<class A, class B>
void CompareMiniSet const A &  ms,
const B &  bvm
 

Definition at line 5639 of file stress.cpp.

References bm::set_total_blocks.

Referenced by MiniSetTest().

void ComparisonTest  ) 
 

Definition at line 2642 of file stress.cpp.

References bm::bvector< Alloc, MS >::clear(), bm::bvector_mini< A >::compare(), bm::bvector< Alloc, MS >::compare(), bm::bvector< Alloc, MS >::optimize(), bm::bvector_mini< A >::set_bit(), and bm::bvector< Alloc, MS >::set_bit().

Referenced by main().

void DesrializationTest2  ) 
 

Definition at line 2777 of file stress.cpp.

References bm::bvector< Alloc, MS >::set_bit(), and size.

Referenced by main().

void DetailedCheckVectors const bvect_mini bvect_min,
const bvect bvect_full,
unsigned  size
 

Definition at line 997 of file stress.cpp.

References bm::bvector< Alloc, MS >::get_bit(), bm::bvector_mini< A >::is_bit_true(), and bm::set_block_shift.

Referenced by CheckVectors().

void EnumeratorTest  ) 
 

Definition at line 5157 of file stress.cpp.

References bm::bvector< Alloc, MS >::clear_bit(), bm::bvector< Alloc, MS >::end(), bm::bvector< Alloc, MS >::enumerator, bm::bvector< Alloc, MS >::first(), bm::bvector< Alloc, MS >::get_first(), bm::bvector< Alloc, MS >::get_next(), bm::id_max, and bm::bvector< Alloc, MS >::set_bit().

Referenced by main().

void ExportTest  ) 
 

Definition at line 6239 of file stress.cpp.

References bm::bvector< Alloc, MS >::count(), bm::export_array(), and bm::bvector< Alloc, MS >::test().

Referenced by main().

void FillSetClearIntervals bvect_mini bvect_min,
bvect bvect_full,
unsigned  min,
unsigned  max,
unsigned  fill_factor
 

Definition at line 615 of file stress.cpp.

References FillSetsIntervals().

Referenced by FillSetsRandomMethod().

void FillSets bvect_mini bvect_min,
bvect bvect_full,
unsigned  min,
unsigned  max,
unsigned  fill_factor
 

Definition at line 348 of file stress.cpp.

References id, random_minmax(), bm::bvector< Alloc, MS >::set_bit(), and bm::bvector_mini< A >::set_bit().

Referenced by FillSetsRandomMethod(), OrOperationsTest(), RangeRandomFillTest(), and SubOperationsTest().

void FillSetsIntervals bvect_mini bvect_min,
bvect bvect_full,
unsigned  min,
unsigned  max,
unsigned  fill_factor,
bool  set_flag = true
 

Definition at line 501 of file stress.cpp.

References len, bm::bvector_mini< A >::set_bit(), and bm::bvector< Alloc, MS >::set_range().

Referenced by FillSetClearIntervals(), FillSetsRandomMethod(), and RangeRandomFillTest().

void FillSetsRandom bvect_mini bvect_min,
bvect bvect_full,
unsigned  min,
unsigned  max,
unsigned  fill_factor
 

Definition at line 626 of file stress.cpp.

Referenced by FillSetsRandomMethod().

void FillSetsRandomMethod bvect_mini bvect_min,
bvect bvect_full,
unsigned  min,
unsigned  max,
int  optimize = 0,
int  method = -1
 

Definition at line 677 of file stress.cpp.

References FillSetClearIntervals(), FillSets(), FillSetsIntervals(), FillSetsRandom(), and bm::bvector< Alloc, MS >::optimize().

void GAPCheck  ) 
 

Definition at line 3479 of file stress.cpp.

References bm::gap_max_bits, gap_vector::set_bit(), and bm::bvector_mini< A >::set_bit().

Referenced by main().

void GetNextTest  ) 
 

Definition at line 4947 of file stress.cpp.

References bm::BM_GAP, bm::bvector_mini< A >::get_first(), bm::bvector< Alloc, MS >::get_first(), bm::bvector_mini< A >::get_next(), bm::bvector< Alloc, MS >::get_next(), bm::bvector_mini< A >::set_bit(), bm::bvector< Alloc, MS >::set_bit(), and bm::bvector< Alloc, MS >::set_new_blocks_strat().

Referenced by main().

int main void   ) 
 

Definition at line 6355 of file stress.cpp.

References AndOperationsTest(), BasicFunctionalityTest(), BitCountChangeTest(), BlockLevelTest(), CalcBeginMask(), CalcEndMask(), ClearAllTest(), ComparisonTest(), DesrializationTest2(), EnumeratorTest(), ExportTest(), GAPCheck(), GetNextTest(), MaxSTest(), MiniSetTest(), MutationOperationsTest(), MutationTest(), OptimGAPTest(), OrOperationsTest(), RangeRandomFillTest(), ResizeTest(), SerializationTest(), SetTest(), SimpleRandomFillTest(), StressTest(), SubOperationsTest(), SyntaxTest(), TestRecomb(), WordCmpTest(), and XorOperationsTest().

void MaxSTest  ) 
 

Definition at line 5085 of file stress.cpp.

References bm::bvector< Alloc, MS >::set_bit().

Referenced by main().

void MiniSetTest  ) 
 

Definition at line 5654 of file stress.cpp.

References CompareMiniSet(), bm::miniset< A, N >::set(), bm::bvector_mini< A >::set_bit(), and bm::set_total_blocks.

Referenced by main().

void MutationOperationsTest  ) 
 

Definition at line 4431 of file stress.cpp.

References bm::bvector< Alloc, MS >::bit_and(), bm::BM_GAP, CheckVectors(), bm::bvector_mini< A >::set_bit(), bm::bvector< Alloc, MS >::set_bit(), and bm::bvector< Alloc, MS >::set_new_blocks_strat().

Referenced by main().

void MutationTest  ) 
 

Definition at line 4355 of file stress.cpp.

References bm::BM_GAP, CheckVectors(), bm::bvector_mini< A >::set_bit(), bm::bvector< Alloc, MS >::set_bit(), and bm::bvector< Alloc, MS >::set_new_blocks_strat().

Referenced by main().

void OptimGAPTest  ) 
 

Definition at line 5829 of file stress.cpp.

References bm::gap_levels, bm::improve_gap_levels(), and PrintGapLevels().

Referenced by main().

void OrOperationsTest  ) 
 

Definition at line 1753 of file stress.cpp.

References bm::any_or(), bm::bvector< Alloc, MS >::bit_or(), bm::BM_BIT, bm::BM_GAP, CheckCountRange(), CheckVectors(), bm::combine_or(), bm::bvector_mini< A >::combine_or(), bm::bvector< Alloc, MS >::count(), bm::count_or(), FillSets(), bm::bvector< Alloc, MS >::first(), bm::bvector< Alloc, MS >::optimize(), SerializationOperation2Test(), bm::bvector< Alloc, MS >::set(), bm::bvector< Alloc, MS >::set_bit(), bm::bvector_mini< A >::set_bit(), bm::set_COUNT_OR, bm::bvector< Alloc, MS >::set_new_blocks_strat(), and bm::set_OR.

Referenced by main().

template<class T>
T* pool_allocate T **  pool,
int &  i,
size_t  n
 

Definition at line 62 of file stress.cpp.

References malloc().

Referenced by pool_block_allocator::allocate().

void* pool_allocate2 void **  pool,
int &  i,
size_t  n
[inline]
 

Definition at line 67 of file stress.cpp.

References malloc().

Referenced by pool_ptr_allocator::allocate().

template<class T>
void pool_free T **  pool,
int &  i,
T *  p
 

Definition at line 74 of file stress.cpp.

References free(), and POOL_SIZE.

Referenced by pool_ptr_allocator::deallocate(), and pool_block_allocator::deallocate().

void print_gap const gap_vector gap_vect,
unsigned  size
 

Definition at line 905 of file stress.cpp.

References buf, bm::gap_length(), gap_vector::get_buf(), and len.

void print_mv const bvect_mini bvect_min,
unsigned  size
 

Definition at line 887 of file stress.cpp.

References bm::bvector_mini< A >::is_bit_true().

void PrintGapLevels const gap_word_t glevel  ) 
 

Definition at line 5818 of file stress.cpp.

References bm::gap_levels.

Referenced by OptimGAPTest().

unsigned random_minmax unsigned  min,
unsigned  max
 

Definition at line 341 of file stress.cpp.

Referenced by FillSets().

void RangeRandomFillTest  ) 
 

Definition at line 1439 of file stress.cpp.

References CheckCountRange(), CheckVectors(), FillSets(), and FillSetsIntervals().

Referenced by main().

void ResizeTest  ) 
 

Definition at line 6057 of file stress.cpp.

References bm::bvector< Alloc, MS >::any(), bm::bvector< Alloc, MS >::calc_stat(), bm::combine_or(), bm::bvector< Alloc, MS >::compare(), bm::bvector< Alloc, MS >::count(), bm::deserialize(), bm::bvector< Alloc, MS >::enumerator, f(), bm::bvector< Alloc, MS >::first(), bm::bvector< Alloc, MS >::get_first(), bm::bvector< Alloc, MS >::get_next(), bm::id_max, bm::bvector< Alloc, MS >::invert(), bm::bvector< Alloc, MS >::resize(), bm::serialize(), bm::bvector< Alloc, MS >::set(), bm::bvector< Alloc, MS >::set_range(), bm::bvector< Alloc, MS >::size(), and bm::bvector< Alloc, MS >::swap().

Referenced by main().

unsigned SerializationOperation bvect bv_target,
bvect bv1,
bvect bv2,
set_operation  op,
bool  check_reverse = false
 

Definition at line 732 of file stress.cpp.

References bm::BM_GAP, bm::bvector< Alloc, MS >::calc_stat(), bm::bvector< Alloc, MS >::compare(), bm::bvector< Alloc, MS >::count(), bm::deserialize(), bm::bvector< Alloc, MS >::opt_compress, bm::bvector< Alloc, MS >::optimize(), bm::serialize(), bm::set_ASSIGN, bm::set_COUNT_SUB_AB, and bm::set_COUNT_SUB_BA.

Referenced by SerializationOperation2Test().

void SerializationOperation2Test bvect bv_target,
bvect bv1,
bvect bv2,
unsigned  predicted_count,
set_operation  op_count,
set_operation  op_combine
 

Definition at line 846 of file stress.cpp.

References bm::bvector< Alloc, MS >::clear(), bm::bvector< Alloc, MS >::count(), SerializationOperation(), and bm::set_AND.

Referenced by AndOperationsTest(), OrOperationsTest(), SubOperationsTest(), and XorOperationsTest().

void SerializationTest  ) 
 

Definition at line 4611 of file stress.cpp.

References bm::bvector< Alloc, MS >::calc_stat(), CheckVectors(), bm::deserialize(), bm::bvector< Alloc, MS >::optimize(), bm::serialize(), bm::bvector_mini< A >::set_bit(), bm::bvector< Alloc, MS >::set_bit(), bm::bvector< Alloc, MS >::set_new_blocks_strat(), bm::set_OR, and size.

Referenced by main().

void SetTest  ) 
 

Definition at line 5459 of file stress.cpp.

References bm::BM_GAP, bm::bvector< Alloc, MS >::calc_stat(), bm::bvector< Alloc, MS >::clear(), bm::bvector< Alloc, MS >::count(), bm::id_max, bm::bvector< Alloc, MS >::invert(), bm::bvector< Alloc, MS >::optimize(), bm::bvector< Alloc, MS >::set(), and bm::bvector< Alloc, MS >::set_bit_conditional().

Referenced by main().

void SimpleRandomFillTest  ) 
 

Definition at line 1346 of file stress.cpp.

References bm::BM_BIT, CheckCountRange(), CheckVectors(), bm::bvector< Alloc, MS >::set_bit(), bm::bvector_mini< A >::set_bit(), and bm::bvector< Alloc, MS >::set_new_blocks_strat().

Referenced by main().

void StressTest int  repetitions  ) 
 

Definition at line 2948 of file stress.cpp.

References bm::BM_GAP, bm::bvector< Alloc, MS >::set_new_blocks_strat(), and size.

Referenced by main().

void SubOperationsTest  ) 
 

Definition at line 1999 of file stress.cpp.

References bm::any_sub(), bm::bvector< Alloc, MS >::bit_sub(), bm::BM_BIT, bm::BM_GAP, CheckCountRange(), CheckVectors(), bm::bvector_mini< A >::combine_sub(), bm::bvector< Alloc, MS >::count(), bm::count_sub(), FillSets(), bm::bvector< Alloc, MS >::optimize(), SerializationOperation2Test(), bm::bvector< Alloc, MS >::set_bit(), bm::bvector_mini< A >::set_bit(), bm::set_COUNT_SUB_AB, bm::bvector< Alloc, MS >::set_new_blocks_strat(), and bm::set_SUB.

Referenced by main().

void SyntaxTest  ) 
 

Definition at line 5416 of file stress.cpp.

References bm::bvector< Alloc, MS >::flip(), bm::bvector< Alloc, MS >::get_allocator(), and bm::bvector< Alloc, MS >::swap().

Referenced by main().

void TestRecomb  ) 
 

Definition at line 6312 of file stress.cpp.

References bm::bit_recomb(), and bm::set_block_size.

Referenced by main().

void WordCmpTest  ) 
 

Definition at line 1180 of file stress.cpp.

References bm::wordcmp(), and bm::wordcmp0().

Referenced by main().

void XorOperationsTest  ) 
 

Definition at line 2178 of file stress.cpp.

References bm::any_xor(), bm::bvector< Alloc, MS >::bit_xor(), bm::BM_GAP, CheckCountRange(), CheckVectors(), bm::bvector_mini< A >::combine_xor(), bm::bvector< Alloc, MS >::count(), bm::count_xor(), SerializationOperation2Test(), bm::bvector< Alloc, MS >::set_bit(), bm::bvector_mini< A >::set_bit(), bm::set_COUNT_XOR, bm::bvector< Alloc, MS >::set_new_blocks_strat(), and bm::set_XOR.

Referenced by main().


Variable Documentation

const unsigned BITVECT_SIZE = 100000000 * 2
 

Definition at line 328 of file stress.cpp.

const unsigned ITERATIONS = 100000
 

Definition at line 330 of file stress.cpp.

const unsigned PROGRESS_PRINT = 2000000
 

Definition at line 331 of file stress.cpp.


Generated on Mon Dec 7 09:43:52 2009 for NCBI C++ ToolKit by  doxygen 1.4.6
Modified on Mon Dec 07 16:22:10 2009 by modify_doxy.py rev. 173732