| 632 | #pragma GCC diagnostic ignored "-Wmissing-declarations" |
| 633 | |
| 634 | int mainEntryClickHouseBenchmark(int argc, char ** argv) |
| 635 | { |
| 636 | using namespace DB; |
| 637 | bool print_stacktrace = true; |
| 638 | |
| 639 | try |
| 640 | { |
| 641 | using boost::program_options::value; |
| 642 | |
| 643 | boost::program_options::options_description desc = createOptionsDescription("Allowed options", getTerminalWidth()); |
| 644 | desc.add_options() |
| 645 | ("help", "produce help message") |
| 646 | ("query", value<std::string>()->default_value(""), "query to execute") |
| 647 | ("concurrency,c", value<unsigned>()->default_value(1), "number of parallel queries") |
| 648 | ("delay,d", value<double>()->default_value(1), "delay between intermediate reports in seconds (set 0 to disable reports)") |
| 649 | ("stage", value<std::string>()->default_value("complete"), "request query processing up to specified stage: complete,fetch_columns,with_mergeable_state,with_mergeable_state_after_aggregation,with_mergeable_state_after_aggregation_and_limit") |
| 650 | ("iterations,i", value<size_t>()->default_value(0), "amount of queries to be executed") |
| 651 | ("timelimit,t", value<double>()->default_value(0.), "stop launch of queries after specified time limit") |
| 652 | ("randomize,r", value<bool>()->default_value(false), "randomize order of execution") |
| 653 | ("json", value<std::string>()->default_value(""), "write final report to specified file in JSON format") |
| 654 | ("host,h", value<Strings>()->multitoken(), "") |
| 655 | ("port,p", value<Ports>()->multitoken(), "") |
| 656 | ("cumulative", "prints cumulative data instead of data per interval") |
| 657 | ("secure,s", "Use TLS connection") |
| 658 | ("user", value<std::string>()->default_value("default"), "") |
| 659 | ("password", value<std::string>()->default_value(""), "") |
| 660 | ("database", value<std::string>()->default_value("default"), "") |
| 661 | ("stacktrace", "print stack traces of exceptions") |
| 662 | ("confidence", value<size_t>()->default_value(5), "set the level of confidence for T-test [0=80%, 1=90%, 2=95%, 3=98%, 4=99%, 5=99.5%(default)") |
| 663 | ("query_id", value<std::string>()->default_value(""), "") |
| 664 | ("detail", "output detail info for all hosts") |
| 665 | ("continue_on_errors", "continue testing even if a query fails") |
| 666 | ("reconnect", "establish new connection for every query") |
| 667 | ; |
| 668 | |
| 669 | Settings settings; |
| 670 | settings.addProgramOptions(desc); |
| 671 | |
| 672 | boost::program_options::variables_map options; |
| 673 | boost::program_options::store(boost::program_options::parse_command_line(argc, argv, desc), options); |
| 674 | boost::program_options::notify(options); |
| 675 | |
| 676 | clearPasswordFromCommandLine(argc, argv); |
| 677 | |
| 678 | if (options.count("help")) |
| 679 | { |
| 680 | std::cout << "Usage: " << argv[0] << " [options] < queries.txt\n"; |
| 681 | std::cout << desc << "\n"; |
| 682 | return 1; |
| 683 | } |
| 684 | |
| 685 | print_stacktrace = options.count("stacktrace"); |
| 686 | |
| 687 | /// NOTE Maybe clickhouse-benchmark should also respect .xml configuration of clickhouse-client. |
| 688 | |
| 689 | UInt16 default_port = options.count("secure") ? DBMS_DEFAULT_SECURE_PORT : DBMS_DEFAULT_PORT; |
| 690 | |
| 691 | UseSSL use_ssl; |
no test coverage detected