diff --git a/include/utils/random/generator.h b/include/utils/random/generator.h index a6313a77c..bf110a99a 100644 --- a/include/utils/random/generator.h +++ b/include/utils/random/generator.h @@ -24,11 +24,12 @@ class StringGenerator : public RandomGenerator, std::default_random_engine> { private: - int size_; + int size_; + public: StringGenerator(int size) : RandomGenerator(std::uniform_int_distribution(32, 126)), -size_(size) {} + size_(size) {} std::string next(int size) { std::string random_string; @@ -39,9 +40,7 @@ size_(size) {} return random_string; } - std::string next() { - return next(size_); - } + std::string next() { return next(size_); } }; template @@ -55,19 +54,18 @@ class NumberGenerator : public RandomGenerator { template class PairGenerator { - private: - FirstGenerator* first_; - SecondGenerator* second_; - public: - PairGenerator(FirstGenerator* first, SecondGenerator* second) : - first_(first), second_(second) {} - auto next() { - return std::make_pair(first_->next(), second_->next()); - } + private: + FirstGenerator *first_; + SecondGenerator *second_; + + public: + PairGenerator(FirstGenerator *first, SecondGenerator *second) + : first_(first), second_(second) {} + auto next() { return std::make_pair(first_->next(), second_->next()); } }; template -auto generate_vector(RandomGenerator& gen, int size) { +auto generate_vector(RandomGenerator &gen, int size) { std::vector elements(size); for (int i = 0; i < size; i++) elements[i] = gen.next(); return elements; diff --git a/tests/benchmark/data_structures/concurrent/concurrent_map.cpp b/tests/benchmark/data_structures/concurrent/concurrent_map.cpp index 56ad6f7de..6b4da1c3f 100644 --- a/tests/benchmark/data_structures/concurrent/concurrent_map.cpp +++ b/tests/benchmark/data_structures/concurrent/concurrent_map.cpp @@ -11,18 +11,18 @@ /* ConcurrentMap Benchmark Test: - tests time of Insertion, Contain and Delete operations - + - benchmarking time per operation - + - test run ConcurrentMap with the following keys and values: - - - - - + - tests run single and multi threaded in range (1, Max_Threads_Per_Cpu) - TODO(sale) implements configurable command line arguments on start + TODO(sale) implements configurable command line arguments on start */ using utils::random::NumberGenerator; @@ -32,7 +32,6 @@ using utils::random::StringGenerator; using IntegerGenerator = NumberGenerator, std::default_random_engine, int>; - template static void InsertValue(benchmark::State& state, ConcurrentMap* map, const std::vector>& elements) { @@ -45,7 +44,6 @@ static void InsertValue(benchmark::State& state, ConcurrentMap* map, state.SetComplexityN(state.range(0)); } - template static void DeleteValue(benchmark::State& state, ConcurrentMap* map, const std::vector> elements) { @@ -58,7 +56,6 @@ static void DeleteValue(benchmark::State& state, ConcurrentMap* map, state.SetComplexityN(state.range(0)); } - template static void ContainsValue(benchmark::State& state, ConcurrentMap* map, const std::vector> elements) {