Runned clang-format over concurrent_map benchmark test and random::utils::generator

This commit is contained in:
sale
2016-11-23 13:47:52 +00:00
parent 0a56df3ddf
commit d8a82b45fc
2 changed files with 17 additions and 22 deletions

View File

@@ -24,11 +24,12 @@ class StringGenerator
: public RandomGenerator<std::uniform_int_distribution<int>,
std::default_random_engine> {
private:
int size_;
int size_;
public:
StringGenerator(int size)
: RandomGenerator(std::uniform_int_distribution<int>(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 <class Distribution, class Generator, class DistributionRangeType>
@@ -55,19 +54,18 @@ class NumberGenerator : public RandomGenerator<Distribution, Generator> {
template <class FirstGenerator, class SecondGenerator>
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 <class RandomGenerator>
auto generate_vector(RandomGenerator& gen, int size) {
auto generate_vector(RandomGenerator &gen, int size) {
std::vector<decltype(gen.next())> elements(size);
for (int i = 0; i < size; i++) elements[i] = gen.next();
return elements;

View File

@@ -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:
- <int,int>
- <int, string>
- <string, int>
- <string, string>
- 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::uniform_int_distribution<int>,
std::default_random_engine, int>;
template <class K, class V>
static void InsertValue(benchmark::State& state, ConcurrentMap<K, V>* map,
const std::vector<std::pair<K, V>>& elements) {
@@ -45,7 +44,6 @@ static void InsertValue(benchmark::State& state, ConcurrentMap<K, V>* map,
state.SetComplexityN(state.range(0));
}
template <class K, class V>
static void DeleteValue(benchmark::State& state, ConcurrentMap<K, V>* map,
const std::vector<std::pair<K, V>> elements) {
@@ -58,7 +56,6 @@ static void DeleteValue(benchmark::State& state, ConcurrentMap<K, V>* map,
state.SetComplexityN(state.range(0));
}
template <class K, class V>
static void ContainsValue(benchmark::State& state, ConcurrentMap<K, V>* map,
const std::vector<std::pair<K, V>> elements) {