From: khizmax Date: Sun, 13 Nov 2016 20:19:15 +0000 (+0300) Subject: stress-test set/map: use hash_size option for FeldmanHashSet/Map X-Git-Tag: v2.2.0~66 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=85f6afc212e0ff7eb75b4c241a2b4c46a604aaa6;p=libcds.git stress-test set/map: use hash_size option for FeldmanHashSet/Map --- diff --git a/test/stress/map/delodd/map_delodd.h b/test/stress/map/delodd/map_delodd.h index e2ea79ac..af0c76de 100644 --- a/test/stress/map/delodd/map_delodd.h +++ b/test/stress/map/delodd/map_delodd.h @@ -37,18 +37,15 @@ namespace map { { uint32_t nKey; uint16_t nThread; - uint16_t pad_; key_thread( size_t key, size_t threadNo ) : nKey( static_cast(key)) , nThread( static_cast(threadNo)) - , pad_(0) {} key_thread() : nKey() , nThread() - , pad_( 0 ) {} }; diff --git a/test/stress/map/delodd/map_delodd_feldman_hashmap.cpp b/test/stress/map/delodd/map_delodd_feldman_hashmap.cpp index 55ca0390..9e2e3dd1 100644 --- a/test/stress/map/delodd/map_delodd_feldman_hashmap.cpp +++ b/test/stress/map/delodd/map_delodd_feldman_hashmap.cpp @@ -33,6 +33,23 @@ namespace map { - CDSSTRESS_FeldmanHashMap_fixed( Map_DelOdd, run_test_extract, key_thread, size_t ) + namespace { + class Map_DelOdd2: public map::Map_DelOdd { + public: + template + void run() + { + typedef typename Map::traits original_traits; + struct traits: public original_traits { + enum { hash_size = sizeof( uint32_t ) + sizeof( uint16_t ) }; + }; + typedef typename Map::template rebind_traits< traits >::result map_type; + + run_test_extract(); + } + }; + + CDSSTRESS_FeldmanHashMap_fixed( Map_DelOdd2, run, key_thread, size_t ) + } } // namespace map diff --git a/test/stress/map/map_type_feldman_hashmap.h b/test/stress/map/map_type_feldman_hashmap.h index 77586405..674b9ac8 100644 --- a/test/stress/map/map_type_feldman_hashmap.h +++ b/test/stress/map/map_type_feldman_hashmap.h @@ -47,6 +47,12 @@ namespace map { { typedef cc::FeldmanHashMap< GC, Key, T, Traits > base_class; public: + + template + struct rebind_traits { + typedef FeldmanHashMap result; + }; + template FeldmanHashMap( Config const& cfg) : base_class( cfg.s_nFeldmanMap_HeadBits, cfg.s_nFeldmanMap_ArrayBits ) diff --git a/test/stress/set/delodd/set_delodd.h b/test/stress/set/delodd/set_delodd.h index 03bb671a..72c0c4cc 100644 --- a/test/stress/set/delodd/set_delodd.h +++ b/test/stress/set/delodd/set_delodd.h @@ -36,18 +36,15 @@ namespace set { { uint32_t nKey; uint16_t nThread; - uint16_t pad_; key_thread( size_t key, size_t threadNo ) : nKey( static_cast(key)) , nThread( static_cast(threadNo)) - , pad_(0) {} key_thread() : nKey() , nThread() - , pad_( 0 ) {} }; diff --git a/test/stress/set/delodd/set_delodd_feldman_hashset.cpp b/test/stress/set/delodd/set_delodd_feldman_hashset.cpp index 6fd7e349..2d09f3c6 100644 --- a/test/stress/set/delodd/set_delodd_feldman_hashset.cpp +++ b/test/stress/set/delodd/set_delodd_feldman_hashset.cpp @@ -33,6 +33,25 @@ namespace set { - CDSSTRESS_FeldmanHashSet_fixed( Set_DelOdd, run_test_extract, key_thread, size_t ) + namespace { + class Set_DelOdd2: public set::Set_DelOdd + { + public: + template + void run() + { + typedef typename Set::traits original_traits; + struct traits: public original_traits + { + enum { hash_size = sizeof(uint32_t) + sizeof(uint16_t) }; + }; + + typedef typename Set::template rebind_traits< traits >::result set_type; + run_test_extract< set_type >(); + } + }; + + CDSSTRESS_FeldmanHashSet_fixed( Set_DelOdd2, run, key_thread, size_t ) + } } // namespace set diff --git a/test/stress/set/set_type_feldman_hashset.h b/test/stress/set/set_type_feldman_hashset.h index 44c3ddf4..ab20e1f6 100644 --- a/test/stress/set/set_type_feldman_hashset.h +++ b/test/stress/set/set_type_feldman_hashset.h @@ -63,6 +63,11 @@ namespace set { typedef typename T::hasher hasher; typedef typename get_extracted_ptr::extracted_ptr extracted_ptr; + template + struct rebind_traits { + typedef FeldmanHashSet result; + }; + template FeldmanHashSet( Config const& cfg ) : base_class( cfg.s_nFeldmanSet_HeadBits, cfg.s_nFeldmanSet_ArrayBits )