37 argsman.
AddArg(
"-priority-level=<l1,l2,l3>",
strprintf(
"Run benchmarks of one or multiple priority level(s) (%s), default: '%s'",
43 std::stringstream ss(str);
44 std::vector<double> numbers;
62 int main(
int argc,
char** argv)
69 tfm::format(std::cerr,
"Error parsing command line arguments: %s\n", error);
74 std::cout <<
"Usage: bench_bitcoin [options]\n" 79 " bench_bitcoin executes microbenchmarks. The quality of the benchmark results\n" 80 " highly depend on the stability of the machine. It can sometimes be difficult\n" 81 " to get stable, repeatable results, so here are a few tips:\n" 83 " * Use pyperf [1] to disable frequency scaling, turbo boost etc. For best\n" 84 " results, use CPU pinning and CPU isolation (see [2]).\n" 86 " * Each call of run() should do exactly the same work. E.g. inserting into\n" 87 " a std::vector doesn't do that as it will reallocate on certain calls. Make\n" 88 " sure each run has exactly the same preconditions.\n" 90 " * If results are still not reliable, increase runtime with e.g.\n" 91 " -min-time=5000 to let a benchmark run for at least 5 seconds.\n" 93 " * bench_bitcoin uses nanobench [3] for which there is extensive\n" 94 " documentation available online.\n" 96 "Environment Variables:\n" 98 " To attach a profiler you can run a benchmark in endless mode. This can be\n" 99 " done with the environment variable NANOBENCH_ENDLESS. E.g. like so:\n" 101 " NANOBENCH_ENDLESS=MuHash ./bench_bitcoin -filter=MuHash\n" 103 " In rare cases it can be useful to suppress stability warnings. This can be\n" 104 " done with the environment variable NANOBENCH_SUPPRESS_WARNINGS, e.g:\n" 106 " NANOBENCH_SUPPRESS_WARNINGS=1 ./bench_bitcoin\n" 111 " https://github.com/psf/pyperf\n" 113 " 2. CPU pinning & isolation\n" 114 " https://pyperf.readthedocs.io/en/latest/system.html\n" 117 " https://github.com/martinus/nanobench\n" 137 }
catch (
const std::exception& e) {
std::string SHA256AutoDetect(sha256_implementation::UseImplementation use_implementation)
Autodetect the best available SHA256 implementation.
fs::path GetPathArg(std::string arg, const fs::path &default_value={}) const
Return path argument or default value.
std::vector< std::string > SplitString(std::string_view str, char sep)
uint8_t StringToPriority(const std::string &str)
static std::vector< double > parseAsymptote(const std::string &str)
bool ParseParameters(int argc, const char *const argv[], std::string &error)
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
static constexpr int64_t DEFAULT_MIN_TIME_MS
std::string GetHelpMessage() const
Get the help string.
static const char * DEFAULT_BENCH_FILTER
static void SetupBenchArgs(ArgsManager &argsman)
std::string ListPriorities()
void AddArg(const std::string &name, const std::string &help, unsigned int flags, const OptionsCategory &cat)
Add argument.
static void RunAll(const Args &args)
void SetupHelpOptions(ArgsManager &args)
Add help options to the args manager.
static const std::string DEFAULT_PRIORITY
Priority level default value, run "all" priority levels.
int64_t GetIntArg(const std::string &strArg, int64_t nDefault) const
Return integer argument or default value.
std::string GetArg(const std::string &strArg, const std::string &strDefault) const
Return string argument or default value.
int main(int argc, char **argv)
bool HelpRequested(const ArgsManager &args)
static uint8_t parsePriorityLevel(const std::string &str)