diff --git a/tests/concurrent/common.h b/tests/concurrent/common.h index e32926251..d43f7976b 100644 --- a/tests/concurrent/common.h +++ b/tests/concurrent/common.h @@ -20,6 +20,9 @@ #include "logging/streams/stdout.hpp" #include "utils/sysinfo/memory.hpp" +// Sets max number of threads that will be used in concurrent tests. +constexpr int max_no_threads=8; + using std::cout; using std::endl; using map_t = ConcurrentMap; diff --git a/tests/concurrent/conncurent_list.cpp b/tests/concurrent/conncurent_list.cpp index ab6bff71e..aeea7bfda 100644 --- a/tests/concurrent/conncurent_list.cpp +++ b/tests/concurrent/conncurent_list.cpp @@ -1,6 +1,6 @@ #include "common.h" -#define THREADS_NO 8 +constexpr size_t THREADS_NO = std::min(max_no_threads, 8); constexpr size_t key_range = 1e2; constexpr size_t op_per_thread = 1e5; // Depending on value there is a possiblity of numerical overflow diff --git a/tests/concurrent/dynamic_bitset.cpp b/tests/concurrent/dynamic_bitset.cpp index 252874650..ac24109ea 100644 --- a/tests/concurrent/dynamic_bitset.cpp +++ b/tests/concurrent/dynamic_bitset.cpp @@ -1,6 +1,6 @@ #include "common.h" -#define THREADS_NO 8 +constexpr size_t THREADS_NO = std::min(max_no_threads, 8); constexpr size_t op_per_thread = 1e5; constexpr size_t bit_part_len = 2; constexpr size_t no_slots = 1e4; diff --git a/tests/concurrent/dynamic_bitset_clear_n.cpp b/tests/concurrent/dynamic_bitset_clear_n.cpp index 61b5384aa..6f38bbf64 100644 --- a/tests/concurrent/dynamic_bitset_clear_n.cpp +++ b/tests/concurrent/dynamic_bitset_clear_n.cpp @@ -1,6 +1,6 @@ #include "common.h" -#define THREADS_NO 4 +constexpr size_t THREADS_NO = std::min(max_no_threads, 4); constexpr size_t op_per_thread = 1e5; constexpr size_t up_border_bit_set_pow2 = 3; constexpr size_t key_range = diff --git a/tests/concurrent/dynamic_bitset_set.cpp b/tests/concurrent/dynamic_bitset_set.cpp index f219a6a97..b1ec1eae8 100644 --- a/tests/concurrent/dynamic_bitset_set.cpp +++ b/tests/concurrent/dynamic_bitset_set.cpp @@ -1,6 +1,6 @@ #include "common.h" -#define THREADS_NO 8 +constexpr size_t THREADS_NO = std::min(max_no_threads, 8); constexpr size_t op_per_thread = 1e5; constexpr size_t key_range = op_per_thread * THREADS_NO * 3; diff --git a/tests/concurrent/dynamic_bitset_set_n.cpp b/tests/concurrent/dynamic_bitset_set_n.cpp index c05118feb..b31bcda2a 100644 --- a/tests/concurrent/dynamic_bitset_set_n.cpp +++ b/tests/concurrent/dynamic_bitset_set_n.cpp @@ -1,6 +1,6 @@ #include "common.h" -#define THREADS_NO 4 +constexpr size_t THREADS_NO = std::min(max_no_threads, 4); constexpr size_t op_per_thread = 1e5; constexpr size_t up_border_bit_set_pow2 = 3; constexpr size_t key_range = diff --git a/tests/concurrent/sl_insert.cpp b/tests/concurrent/sl_insert.cpp index a0b83e18f..7948c2291 100644 --- a/tests/concurrent/sl_insert.cpp +++ b/tests/concurrent/sl_insert.cpp @@ -1,6 +1,6 @@ #include "common.h" -#define THREADS_NO 8 +constexpr size_t THREADS_NO = std::min(max_no_threads, 8); constexpr size_t elems_per_thread = 100000; constexpr size_t key_range = elems_per_thread * THREADS_NO * 2; diff --git a/tests/concurrent/sl_insert_competetive.cpp b/tests/concurrent/sl_insert_competetive.cpp index 8050a377c..636ca9264 100644 --- a/tests/concurrent/sl_insert_competetive.cpp +++ b/tests/concurrent/sl_insert_competetive.cpp @@ -1,6 +1,6 @@ #include "common.h" -#define THREADS_NO 8 +constexpr size_t THREADS_NO = std::min(max_no_threads, 8); constexpr size_t elems_per_thread = 100000; constexpr size_t key_range = elems_per_thread * THREADS_NO * 2; diff --git a/tests/concurrent/sl_map.cpp b/tests/concurrent/sl_map.cpp index 8b7684073..c56a1aa2f 100644 --- a/tests/concurrent/sl_map.cpp +++ b/tests/concurrent/sl_map.cpp @@ -1,6 +1,6 @@ #include "common.h" -#define THREADS_NO 8 +constexpr size_t THREADS_NO = std::min(max_no_threads, 8); constexpr size_t elems_per_thread = 1e5; int main() diff --git a/tests/concurrent/sl_memory.cpp b/tests/concurrent/sl_memory.cpp index cc7522a3b..f69bd66a5 100644 --- a/tests/concurrent/sl_memory.cpp +++ b/tests/concurrent/sl_memory.cpp @@ -1,6 +1,6 @@ #include "common.h" -#define THREADS_NO 8 +constexpr size_t THREADS_NO = std::min(max_no_threads, 8); constexpr size_t elements = 2e6; diff --git a/tests/concurrent/sl_memory_leak.cpp b/tests/concurrent/sl_memory_leak.cpp index c5e384ee5..6c7bf64da 100644 --- a/tests/concurrent/sl_memory_leak.cpp +++ b/tests/concurrent/sl_memory_leak.cpp @@ -1,6 +1,6 @@ #include "common.h" -#define THREADS_NO 1 +constexpr size_t THREADS_NO = std::min(max_no_threads, 1); constexpr size_t elems_per_thread = 16e5; // Known memory leak at 1,600,000 elements. diff --git a/tests/concurrent/sl_multiiterator.cpp b/tests/concurrent/sl_multiiterator.cpp index ebff8c0ca..68bde7fbc 100644 --- a/tests/concurrent/sl_multiiterator.cpp +++ b/tests/concurrent/sl_multiiterator.cpp @@ -1,6 +1,6 @@ #include "common.h" -#define THREADS_NO 8 +constexpr size_t THREADS_NO = std::min(max_no_threads, 8); constexpr size_t key_range = 1e4; constexpr size_t op_per_thread = 1e5; // Depending on value there is a possiblity of numerical overflow diff --git a/tests/concurrent/sl_multiiterator_remove.cpp b/tests/concurrent/sl_multiiterator_remove.cpp index e8b8e3d07..228788e7f 100644 --- a/tests/concurrent/sl_multiiterator_remove.cpp +++ b/tests/concurrent/sl_multiiterator_remove.cpp @@ -1,6 +1,6 @@ #include "common.h" -#define THREADS_NO 8 +constexpr size_t THREADS_NO = std::min(max_no_threads, 8); constexpr size_t key_range = 1e4; constexpr size_t op_per_thread = 1e5; // Depending on value there is a possiblity of numerical overflow diff --git a/tests/concurrent/sl_multiiterator_remove_duplicates.cpp b/tests/concurrent/sl_multiiterator_remove_duplicates.cpp index da2215ec0..01712d199 100644 --- a/tests/concurrent/sl_multiiterator_remove_duplicates.cpp +++ b/tests/concurrent/sl_multiiterator_remove_duplicates.cpp @@ -1,6 +1,6 @@ #include "common.h" -#define THREADS_NO 4 +constexpr size_t THREADS_NO = std::min(max_no_threads, 4); constexpr size_t key_range = 1e4; constexpr size_t op_per_thread = 1e5; // Depending on value there is a possiblity of numerical overflow diff --git a/tests/concurrent/sl_multimap.cpp b/tests/concurrent/sl_multimap.cpp index 5953a4ca5..9c1fa97ba 100644 --- a/tests/concurrent/sl_multimap.cpp +++ b/tests/concurrent/sl_multimap.cpp @@ -1,6 +1,6 @@ #include "common.h" -#define THREADS_NO 8 +constexpr size_t THREADS_NO = std::min(max_no_threads, 8); constexpr size_t key_range = 1e4; constexpr size_t op_per_thread = 1e5; // Depending on value there is a possiblity of numerical overflow diff --git a/tests/concurrent/sl_multiset.cpp b/tests/concurrent/sl_multiset.cpp index eaca13ca0..9a5bdd006 100644 --- a/tests/concurrent/sl_multiset.cpp +++ b/tests/concurrent/sl_multiset.cpp @@ -1,6 +1,6 @@ #include "common.h" -#define THREADS_NO 8 +constexpr size_t THREADS_NO = std::min(max_no_threads, 8); constexpr size_t key_range = 1e4; constexpr size_t op_per_thread = 1e5; constexpr size_t no_insert_for_one_delete = 1; diff --git a/tests/concurrent/sl_remove_competetive.cpp b/tests/concurrent/sl_remove_competetive.cpp index 614d00d46..13a7967da 100644 --- a/tests/concurrent/sl_remove_competetive.cpp +++ b/tests/concurrent/sl_remove_competetive.cpp @@ -1,6 +1,6 @@ #include "common.h" -#define THREADS_NO 8 +constexpr size_t THREADS_NO = std::min(max_no_threads, 8); constexpr size_t op_per_thread = 1e5; // Depending on value there is a possiblity of numerical overflow constexpr size_t max_number = 10; diff --git a/tests/concurrent/sl_remove_disjoint.cpp b/tests/concurrent/sl_remove_disjoint.cpp index 031d5106e..99b9465ca 100644 --- a/tests/concurrent/sl_remove_disjoint.cpp +++ b/tests/concurrent/sl_remove_disjoint.cpp @@ -1,6 +1,6 @@ #include "common.h" -#define THREADS_NO 8 +constexpr size_t THREADS_NO = std::min(max_no_threads, 8); constexpr size_t key_range = 1e5; constexpr size_t op_per_thread = 1e6; constexpr size_t no_insert_for_one_delete = 1; diff --git a/tests/concurrent/sl_remove_joint.cpp b/tests/concurrent/sl_remove_joint.cpp index b32bae485..495433966 100644 --- a/tests/concurrent/sl_remove_joint.cpp +++ b/tests/concurrent/sl_remove_joint.cpp @@ -1,6 +1,6 @@ #include "common.h" -#define THREADS_NO 8 +constexpr size_t THREADS_NO = std::min(max_no_threads, 8); constexpr size_t key_range = 1e4; constexpr size_t op_per_thread = 1e5; // Depending on value there is a possiblity of numerical overflow diff --git a/tests/concurrent/sl_set.cpp b/tests/concurrent/sl_set.cpp index e86d0a6ae..84c6c582c 100644 --- a/tests/concurrent/sl_set.cpp +++ b/tests/concurrent/sl_set.cpp @@ -1,6 +1,6 @@ #include "common.h" -#define THREADS_NO 8 +constexpr size_t THREADS_NO = std::min(max_no_threads, 8); constexpr size_t key_range = 1e4; constexpr size_t op_per_thread = 1e5; constexpr size_t no_insert_for_one_delete = 2; diff --git a/tests/concurrent/sl_simulation.cpp b/tests/concurrent/sl_simulation.cpp index 564d3d1eb..ffeb11f2c 100644 --- a/tests/concurrent/sl_simulation.cpp +++ b/tests/concurrent/sl_simulation.cpp @@ -1,6 +1,6 @@ #include "common.h" -#define THREADS_NO 8 +constexpr size_t THREADS_NO = std::min(max_no_threads, 8); constexpr size_t key_range = 1e5; constexpr size_t op_per_thread = 1e6; // Depending on value there is a possiblity of numerical overflow diff --git a/tests/integration/snapshot.cpp b/tests/integration/snapshot.cpp index c68c1a5bd..50975722d 100644 --- a/tests/integration/snapshot.cpp +++ b/tests/integration/snapshot.cpp @@ -188,7 +188,6 @@ int main(void) // empty database // import snapshot // assert database empty - Db db("snapshot", false); db.snap_engine.make_snapshot(); run(cvl_n, create_vertex_label, db); diff --git a/tests/poc/profile.cpp b/tests/poc/profile.cpp deleted file mode 100644 index e69de29bb..000000000