Changeset View
Changeset View
Standalone View
Standalone View
src/bench/bench_bitcoin.cpp
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | static void SetupBenchArgs() { | ||||
gArgs.AddArg("-help", "", ArgsManager::ALLOW_ANY, OptionsCategory::HIDDEN); | gArgs.AddArg("-help", "", ArgsManager::ALLOW_ANY, OptionsCategory::HIDDEN); | ||||
} | } | ||||
int main(int argc, char **argv) { | int main(int argc, char **argv) { | ||||
SetupBenchArgs(); | SetupBenchArgs(); | ||||
std::string error; | std::string error; | ||||
if (!gArgs.ParseParameters(argc, argv, error)) { | if (!gArgs.ParseParameters(argc, argv, error)) { | ||||
tfm::format(std::cerr, "Error parsing command line arguments: %s\n", | tfm::format(std::cerr, "Error parsing command line arguments: %s\n", | ||||
error.c_str()); | error); | ||||
return EXIT_FAILURE; | return EXIT_FAILURE; | ||||
} | } | ||||
if (HelpRequested(gArgs)) { | if (HelpRequested(gArgs)) { | ||||
std::cout << gArgs.GetHelpMessage(); | std::cout << gArgs.GetHelpMessage(); | ||||
return EXIT_SUCCESS; | return EXIT_SUCCESS; | ||||
} | } | ||||
int64_t evaluations = gArgs.GetArg("-evals", DEFAULT_BENCH_EVALUATIONS); | int64_t evaluations = gArgs.GetArg("-evals", DEFAULT_BENCH_EVALUATIONS); | ||||
std::string regex_filter = gArgs.GetArg("-filter", DEFAULT_BENCH_FILTER); | std::string regex_filter = gArgs.GetArg("-filter", DEFAULT_BENCH_FILTER); | ||||
std::string scaling_str = gArgs.GetArg("-scaling", DEFAULT_BENCH_SCALING); | std::string scaling_str = gArgs.GetArg("-scaling", DEFAULT_BENCH_SCALING); | ||||
bool is_list_only = gArgs.GetBoolArg("-list", false); | bool is_list_only = gArgs.GetBoolArg("-list", false); | ||||
double scaling_factor; | double scaling_factor; | ||||
if (!ParseDouble(scaling_str, &scaling_factor)) { | if (!ParseDouble(scaling_str, &scaling_factor)) { | ||||
tfm::format(std::cerr, "Error parsing scaling factor as double: %s\n", | tfm::format(std::cerr, "Error parsing scaling factor as double: %s\n", | ||||
scaling_str.c_str()); | scaling_str); | ||||
return EXIT_FAILURE; | return EXIT_FAILURE; | ||||
} | } | ||||
std::unique_ptr<benchmark::Printer> printer = | std::unique_ptr<benchmark::Printer> printer = | ||||
std::make_unique<benchmark::ConsolePrinter>(); | std::make_unique<benchmark::ConsolePrinter>(); | ||||
std::string printer_arg = gArgs.GetArg("-printer", DEFAULT_BENCH_PRINTER); | std::string printer_arg = gArgs.GetArg("-printer", DEFAULT_BENCH_PRINTER); | ||||
if ("plot" == printer_arg) { | if ("plot" == printer_arg) { | ||||
printer.reset(new benchmark::PlotlyPrinter( | printer.reset(new benchmark::PlotlyPrinter( | ||||
Show All 13 Lines |