T101
Summary: Created Basic Random Utility; Created folder for benchmark query stripper Test Plan: manual Reviewers: buda Subscribers: buda Differential Revision: https://memgraph.phacility.com/D6
This commit is contained in:
parent
5a8a7bea65
commit
09edde8572
@ -1,44 +0,0 @@
|
||||
#include "logging/default.hpp"
|
||||
#include "logging/streams/stdout.hpp"
|
||||
#include "utils/time/timer.hpp"
|
||||
#include "query/preprocesor.hpp"
|
||||
|
||||
#include "benchmark/benchmark_api.h"
|
||||
#include "yaml-cpp/yaml.h"
|
||||
|
||||
auto BM_Strip = [](benchmark::State& state, auto& function, std::string query) {
|
||||
while (state.KeepRunning()) {
|
||||
for (int start = 0; start < state.range(0); start++) {
|
||||
function(query);
|
||||
}
|
||||
}
|
||||
state.SetComplexityN(state.range(0));
|
||||
};
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
logging::init_async();
|
||||
logging::log->pipe(std::make_unique<Stdout>());
|
||||
|
||||
YAML::Node dataset = YAML::LoadFile(
|
||||
"../../tests/data/cypher_queries/stripper/query_dict.yaml");
|
||||
|
||||
QueryPreprocessor processor;
|
||||
using std::placeholders::_1;
|
||||
std::function<QueryStripped(const std::string& query)> preprocess =
|
||||
std::bind(&QueryPreprocessor::preprocess, &processor, _1);
|
||||
|
||||
auto tests = dataset["benchmark_queries"].as<std::vector<std::string>>();
|
||||
for (auto& test : tests) {
|
||||
auto* benchmark =
|
||||
benchmark::RegisterBenchmark(test.c_str(), BM_Strip, preprocess, test)
|
||||
->RangeMultiplier(2)
|
||||
->Range(1, 8 << 10)
|
||||
->Complexity(benchmark::oN);
|
||||
;
|
||||
}
|
||||
|
||||
benchmark::Initialize(&argc, argv);
|
||||
benchmark::RunSpecifiedBenchmarks();
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user