13 #include <validation.h>
17 static const int64_t DEFAULT_BENCH_EVALUATIONS = 5;
18 static const char* DEFAULT_BENCH_FILTER =
".*";
19 static const char* DEFAULT_BENCH_SCALING =
"1.0";
20 static const char* DEFAULT_BENCH_PRINTER =
"console";
21 static const char* DEFAULT_PLOT_PLOTLYURL =
"https://cdn.plot.ly/plotly-latest.min.js";
22 static const int64_t DEFAULT_PLOT_WIDTH = 1024;
23 static const int64_t DEFAULT_PLOT_HEIGHT = 768;
36 <<
HelpMessageOpt(
"-list",
_(
"List benchmarks without executing them. Can be combined with -scaling and -filter"))
37 <<
HelpMessageOpt(
"-evals=<n>",
strprintf(
_(
"Number of measurement evaluations to perform. (default: %u)"), DEFAULT_BENCH_EVALUATIONS))
38 <<
HelpMessageOpt(
"-filter=<regex>",
strprintf(
_(
"Regular expression filter to select benchmark by name (default: %s)"), DEFAULT_BENCH_FILTER))
39 <<
HelpMessageOpt(
"-scaling=<n>",
strprintf(
_(
"Scaling factor for benchmark's runtime (default: %u)"), DEFAULT_BENCH_SCALING))
40 <<
HelpMessageOpt(
"-printer=(console|plot)",
strprintf(
_(
"Choose printer format. console: print data to console. plot: Print results as HTML graph (default: %s)"), DEFAULT_BENCH_PRINTER))
41 <<
HelpMessageOpt(
"-plot-plotlyurl=<uri>",
strprintf(
_(
"URL to use for plotly.js (default: %s)"), DEFAULT_PLOT_PLOTLYURL))
57 int64_t evaluations =
gArgs.
GetArg(
"-evals", DEFAULT_BENCH_EVALUATIONS);
58 std::string regex_filter =
gArgs.
GetArg(
"-filter", DEFAULT_BENCH_FILTER);
59 std::string scaling_str =
gArgs.
GetArg(
"-scaling", DEFAULT_BENCH_SCALING);
62 double scaling_factor;
64 fprintf(stderr,
"Error parsing scaling factor as double: %s\n", scaling_str.c_str());
69 std::string printer_arg =
gArgs.
GetArg(
"-printer", DEFAULT_BENCH_PRINTER);
70 if (
"plot" == printer_arg) {
72 gArgs.
GetArg(
"-plot-plotlyurl", DEFAULT_PLOT_PLOTLYURL),
74 gArgs.
GetArg(
"-plot-height", DEFAULT_PLOT_HEIGHT)));
int main(int argc, char **argv)
void CleanupBLSDkgTests()
void ParseParameters(int argc, const char *const argv[])
bool IsArgSet(const std::string &strArg) const
Return true if the given argument has been manually set.
std::string GetArg(const std::string &strArg, const std::string &strDefault) const
Return string argument or default value.
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
Users of this module must hold an ECCVerifyHandle.
static void RunAll(Printer &printer, uint64_t num_evals, double scaling, const std::string &filter, bool is_list_only)
void ECC_Start()
Initialize the elliptic curve support.
void ECC_Stop()
Deinitialize the elliptic curve support.
BCLog::Logger *const g_logger
NOTE: the logger instances is leaked on exit.
void RandomInit()
Initialize global RNG state and log any CPU features that are used.
std::string HelpMessageGroup(const std::string &message)
Format a string to be used as group of options in help messages.
std::string HelpMessageOpt(const std::string &option, const std::string &message)
Format a string to be used as option description in help messages.
std::string _(const char *psz)
Translation function: Call Translate signal on UI interface, which returns a Optional result.
bool ParseDouble(const std::string &str, double *out)
Convert string to double with strict parse error feedback.