#include #include #include "Runner.h" #include "Stats.h" #include "Generator.h" #include #include using namespace std; int main(int argc, char *argv[]) { bool print_stacktrace = true; try { using boost::program_options::value; boost::program_options::options_description desc = createOptionsDescription("Allowed options", getTerminalWidth()); desc.add_options() ("help", "produce help message") ("generator", value()->default_value("set_small_data"), "query to execute") ("concurrency,c", value()->default_value(1), "number of parallel queries") ("delay,d", value()->default_value(1), "delay between intermediate reports in seconds (set 0 to disable reports)") ("iterations,i", value()->default_value(0), "amount of queries to be executed") ("timelimit,t", value()->default_value(0.), "stop launch of queries after specified time limit") ("hosts,h", value()->multitoken(), "") ("continue_on_errors", "continue testing even if a query fails") ("reconnect", "establish new connection for every query") ; boost::program_options::variables_map options; boost::program_options::store(boost::program_options::parse_command_line(argc, argv, desc), options); boost::program_options::notify(options); if (options.count("help")) { std::cout << "Usage: " << argv[0] << " [options] < queries.txt\n"; std::cout << desc << "\n"; return 1; } Runner runner(options["concurrency"].as(), options["generator"].as(), options["hosts"].as(), options["timelimit"].as(), options["delay"].as(), options.count("continue_on_errors"), options["iterations"].as()); runner.runBenchmark(); return 0; } catch (...) { std::cerr << DB::getCurrentExceptionMessage(print_stacktrace, true) << std::endl; return DB::getCurrentExceptionCode(); } }