diff --git a/map/benchmark_tool/api.hpp b/map/benchmark_tool/api.hpp index 27025cd740..1e9b56ebfa 100644 --- a/map/benchmark_tool/api.hpp +++ b/map/benchmark_tool/api.hpp @@ -2,4 +2,5 @@ #include "../../std/string.hpp" -void RunFeaturesLoadingBenchmark(string const & file); +/// @param[in] count number of times to run benchmark +void RunFeaturesLoadingBenchmark(string const & file, size_t count); diff --git a/map/benchmark_tool/benchmark_tool.pro b/map/benchmark_tool/benchmark_tool.pro index 91cf9caa41..71117646ea 100644 --- a/map/benchmark_tool/benchmark_tool.pro +++ b/map/benchmark_tool/benchmark_tool.pro @@ -1,6 +1,6 @@ # Map library tests. -TARGET = map_benchmark +TARGET = benchmark_tool CONFIG += console CONFIG -= app_bundle TEMPLATE = app diff --git a/map/benchmark_tool/features_loading.cpp b/map/benchmark_tool/features_loading.cpp index 6770bf340d..aeda097f96 100644 --- a/map/benchmark_tool/features_loading.cpp +++ b/map/benchmark_tool/features_loading.cpp @@ -82,7 +82,7 @@ namespace } } -void RunFeaturesLoadingBenchmark(string const & file) +void RunFeaturesLoadingBenchmark(string const & file, size_t count) { model::FeaturesFetcher src; src.InitClassificator(); diff --git a/map/benchmark_tool/main.cpp b/map/benchmark_tool/main.cpp index 068dbd6920..8e9d5cbc89 100644 --- a/map/benchmark_tool/main.cpp +++ b/map/benchmark_tool/main.cpp @@ -1,16 +1,23 @@ -#include "../../base/SRC_FIRST.hpp" - #include "api.hpp" #include "../../3party/gflags/src/gflags/gflags.h" - -DEFINE_string(input, "", "Data file name."); +DEFINE_string(input, "", "MWM file name in the data directory"); +DEFINE_int32(count, 3, "How many times to run benchmark"); int main(int argc, char ** argv) { - google::ParseCommandLineFlags(&argc, &argv, true); + google::SetUsageMessage("MWM benchmarking tool"); + if (argc < 2) + { + google::ShowUsageWithFlagsRestrict(argv[0], "main"); + return 0; + } + + google::ParseCommandLineFlags(&argc, &argv, false); + + if (!FLAGS_input.empty()) + RunFeaturesLoadingBenchmark(FLAGS_input, FLAGS_count); - RunFeaturesLoadingBenchmark(FLAGS_input); return 0; }