Changeset View
Changeset View
Standalone View
Standalone View
src/bench/bench_bitcoin.cpp
Show All 15 Lines | |||||
static const char *DEFAULT_BENCH_SCALING = "1.0"; | static const char *DEFAULT_BENCH_SCALING = "1.0"; | ||||
static const char *DEFAULT_BENCH_PRINTER = "console"; | static const char *DEFAULT_BENCH_PRINTER = "console"; | ||||
static const char *DEFAULT_PLOT_PLOTLYURL = | static const char *DEFAULT_PLOT_PLOTLYURL = | ||||
"https://cdn.plot.ly/plotly-latest.min.js"; | "https://cdn.plot.ly/plotly-latest.min.js"; | ||||
static const int64_t DEFAULT_PLOT_WIDTH = 1024; | static const int64_t DEFAULT_PLOT_WIDTH = 1024; | ||||
static const int64_t DEFAULT_PLOT_HEIGHT = 768; | static const int64_t DEFAULT_PLOT_HEIGHT = 768; | ||||
static void SetupBenchArgs() { | static void SetupBenchArgs() { | ||||
gArgs.AddArg("-?", "Print this help message and exit", false, | gArgs.AddArg("-?", "Print this help message and exit", | ||||
OptionsCategory::OPTIONS); | ArgsManager::ALLOW_ANY, false, OptionsCategory::OPTIONS); | ||||
gArgs.AddArg("-list", | gArgs.AddArg("-list", | ||||
"List benchmarks without executing them. Can be combined " | "List benchmarks without executing them. Can be combined " | ||||
"with -scaling and -filter", | "with -scaling and -filter", | ||||
false, OptionsCategory::OPTIONS); | ArgsManager::ALLOW_ANY, false, OptionsCategory::OPTIONS); | ||||
gArgs.AddArg( | gArgs.AddArg( | ||||
"-evals=<n>", | "-evals=<n>", | ||||
strprintf("Number of measurement evaluations to perform. (default: %u)", | strprintf("Number of measurement evaluations to perform. (default: %u)", | ||||
DEFAULT_BENCH_EVALUATIONS), | DEFAULT_BENCH_EVALUATIONS), | ||||
false, OptionsCategory::OPTIONS); | ArgsManager::ALLOW_ANY, false, OptionsCategory::OPTIONS); | ||||
gArgs.AddArg("-filter=<regex>", | gArgs.AddArg("-filter=<regex>", | ||||
strprintf("Regular expression filter to select benchmark by " | strprintf("Regular expression filter to select benchmark by " | ||||
"name (default: %s)", | "name (default: %s)", | ||||
DEFAULT_BENCH_FILTER), | DEFAULT_BENCH_FILTER), | ||||
false, OptionsCategory::OPTIONS); | ArgsManager::ALLOW_ANY, false, OptionsCategory::OPTIONS); | ||||
gArgs.AddArg( | gArgs.AddArg( | ||||
"-scaling=<n>", | "-scaling=<n>", | ||||
strprintf("Scaling factor for benchmark's runtime (default: %u)", | strprintf("Scaling factor for benchmark's runtime (default: %u)", | ||||
DEFAULT_BENCH_SCALING), | DEFAULT_BENCH_SCALING), | ||||
false, OptionsCategory::OPTIONS); | ArgsManager::ALLOW_ANY, false, OptionsCategory::OPTIONS); | ||||
gArgs.AddArg( | gArgs.AddArg( | ||||
"-printer=(console|plot)", | "-printer=(console|plot)", | ||||
strprintf("Choose printer format. console: print data to console. " | strprintf("Choose printer format. console: print data to console. " | ||||
"plot: Print results as HTML graph (default: %s)", | "plot: Print results as HTML graph (default: %s)", | ||||
DEFAULT_BENCH_PRINTER), | DEFAULT_BENCH_PRINTER), | ||||
false, OptionsCategory::OPTIONS); | ArgsManager::ALLOW_ANY, false, OptionsCategory::OPTIONS); | ||||
gArgs.AddArg("-plot-plotlyurl=<uri>", | gArgs.AddArg("-plot-plotlyurl=<uri>", | ||||
strprintf("URL to use for plotly.js (default: %s)", | strprintf("URL to use for plotly.js (default: %s)", | ||||
DEFAULT_PLOT_PLOTLYURL), | DEFAULT_PLOT_PLOTLYURL), | ||||
false, OptionsCategory::OPTIONS); | ArgsManager::ALLOW_ANY, false, OptionsCategory::OPTIONS); | ||||
gArgs.AddArg( | gArgs.AddArg( | ||||
"-plot-width=<x>", | "-plot-width=<x>", | ||||
strprintf("Plot width in pixel (default: %u)", DEFAULT_PLOT_WIDTH), | strprintf("Plot width in pixel (default: %u)", DEFAULT_PLOT_WIDTH), | ||||
false, OptionsCategory::OPTIONS); | ArgsManager::ALLOW_ANY, false, OptionsCategory::OPTIONS); | ||||
gArgs.AddArg( | gArgs.AddArg( | ||||
"-plot-height=<x>", | "-plot-height=<x>", | ||||
strprintf("Plot height in pixel (default: %u)", DEFAULT_PLOT_HEIGHT), | strprintf("Plot height in pixel (default: %u)", DEFAULT_PLOT_HEIGHT), | ||||
false, OptionsCategory::OPTIONS); | ArgsManager::ALLOW_ANY, false, OptionsCategory::OPTIONS); | ||||
// Hidden | // Hidden | ||||
gArgs.AddArg("-h", "", false, OptionsCategory::HIDDEN); | gArgs.AddArg("-h", "", ArgsManager::ALLOW_ANY, false, | ||||
gArgs.AddArg("-help", "", false, OptionsCategory::HIDDEN); | OptionsCategory::HIDDEN); | ||||
gArgs.AddArg("-help", "", ArgsManager::ALLOW_ANY, false, | |||||
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)) { | ||||
fprintf(stderr, "Error parsing command line arguments: %s\n", | fprintf(stderr, "Error parsing command line arguments: %s\n", | ||||
error.c_str()); | error.c_str()); | ||||
Show All 35 Lines |