9 #include <validation.h> 13 #include <boost/lexical_cast.hpp> 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;
26 main(
int argc,
char** argv)
33 <<
HelpMessageOpt(
"-list",
_(
"List benchmarks without executing them. Can be combined with -scaling and -filter"))
34 <<
HelpMessageOpt(
"-evals=<n>",
strprintf(
_(
"Number of measurement evaluations to perform. (default: %u)"), DEFAULT_BENCH_EVALUATIONS))
35 <<
HelpMessageOpt(
"-filter=<regex>",
strprintf(
_(
"Regular expression filter to select benchmark by name (default: %s)"), DEFAULT_BENCH_FILTER))
36 <<
HelpMessageOpt(
"-scaling=<n>",
strprintf(
_(
"Scaling factor for benchmark's runtime (default: %u)"), DEFAULT_BENCH_SCALING))
37 <<
HelpMessageOpt(
"-printer=(console|plot)",
strprintf(
_(
"Choose printer format. console: print data to console. plot: Print results as HTML graph (default: %s)"), DEFAULT_BENCH_PRINTER))
38 <<
HelpMessageOpt(
"-plot-plotlyurl=<uri>",
strprintf(
_(
"URL to use for plotly.js (default: %s)"), DEFAULT_PLOT_PLOTLYURL))
51 int64_t evaluations =
gArgs.
GetArg(
"-evals", DEFAULT_BENCH_EVALUATIONS);
52 std::string regex_filter =
gArgs.
GetArg(
"-filter", DEFAULT_BENCH_FILTER);
53 std::string scaling_str =
gArgs.
GetArg(
"-scaling", DEFAULT_BENCH_SCALING);
56 double scaling_factor = boost::lexical_cast<
double>(scaling_str);
60 std::string printer_arg =
gArgs.
GetArg(
"-printer", DEFAULT_BENCH_PRINTER);
61 if (
"plot" == printer_arg) {
63 gArgs.
GetArg(
"-plot-plotlyurl", DEFAULT_PLOT_PLOTLYURL),
65 gArgs.
GetArg(
"-plot-height", DEFAULT_PLOT_HEIGHT)));
void RandomInit()
Initialize the RNG.
std::string HelpMessageOpt(const std::string &option, const std::string &message)
Format a string to be used as option description in help messages.
void ECC_Start()
Initialize the elliptic curve support.
void ParseParameters(int argc, const char *const argv[])
bool IsArgSet(const std::string &strArg)
Return true if the given argument has been manually set.
bool GetBoolArg(const std::string &strArg, bool fDefault)
Return boolean argument or default value.
std::string SHA256AutoDetect()
Autodetect the best available SHA256 implementation.
int main(int argc, char **argv)
void ECC_Stop()
Deinitialize the elliptic curve support.
static void RunAll(Printer &printer, uint64_t num_evals, double scaling, const std::string &filter, bool is_list_only)
std::string GetArg(const std::string &strArg, const std::string &strDefault)
Return string argument or default value.
std::string HelpMessageGroup(const std::string &message)
Format a string to be used as group of options in help messages.
std::string _(const char *psz)
Translation function: Call Translate signal on UI interface, which returns a boost::optional result...