MCPcopy Create free account
hub / github.com/ElementsProject/elements / main

Function main

src/bench/bench_bitcoin.cpp:47–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47int main(int argc, char** argv)
48{
49 ArgsManager argsman;
50 SetupBenchArgs(argsman);
51 SHA256AutoDetect();
52 std::string error;
53 if (!argsman.ParseParameters(argc, argv, error)) {
54 tfm::format(std::cerr, "Error parsing command line arguments: %s\n", error);
55 return EXIT_FAILURE;
56 }
57
58 if (HelpRequested(argsman)) {
59 std::cout << "Usage: bench_bitcoin [options]\n"
60 "\n"
61 << argsman.GetHelpMessage()
62 << "Description:\n"
63 "\n"
64 " bench_bitcoin executes microbenchmarks. The quality of the benchmark results\n"
65 " highly depend on the stability of the machine. It can sometimes be difficult\n"
66 " to get stable, repeatable results, so here are a few tips:\n"
67 "\n"
68 " * Use pyperf [1] to disable frequency scaling, turbo boost etc. For best\n"
69 " results, use CPU pinning and CPU isolation (see [2]).\n"
70 "\n"
71 " * Each call of run() should do exactly the same work. E.g. inserting into\n"
72 " a std::vector doesn't do that as it will reallocate on certain calls. Make\n"
73 " sure each run has exactly the same preconditions.\n"
74 "\n"
75 " * If results are still not reliable, increase runtime with e.g.\n"
76 " -min_time=5000 to let a benchmark run for at least 5 seconds.\n"
77 "\n"
78 " * bench_bitcoin uses nanobench [3] for which there is extensive\n"
79 " documentation available online.\n"
80 "\n"
81 "Environment Variables:\n"
82 "\n"
83 " To attach a profiler you can run a benchmark in endless mode. This can be\n"
84 " done with the environment variable NANOBENCH_ENDLESS. E.g. like so:\n"
85 "\n"
86 " NANOBENCH_ENDLESS=MuHash ./bench_bitcoin -filter=MuHash\n"
87 "\n"
88 " In rare cases it can be useful to suppress stability warnings. This can be\n"
89 " done with the environment variable NANOBENCH_SUPPRESS_WARNINGS, e.g:\n"
90 "\n"
91 " NANOBENCH_SUPPRESS_WARNINGS=1 ./bench_bitcoin\n"
92 "\n"
93 "Notes:\n"
94 "\n"
95 " 1. pyperf\n"
96 " https://github.com/psf/pyperf\n"
97 "\n"
98 " 2. CPU pinning & isolation\n"
99 " https://pyperf.readthedocs.io/en/latest/system.html\n"
100 "\n"
101 " 3. nanobench\n"
102 " https://github.com/martinus/nanobench\n"
103 "\n";
104

Callers

nothing calls this directly

Calls 11

SetupBenchArgsFunction · 0.85
SHA256AutoDetectFunction · 0.85
HelpRequestedFunction · 0.85
parseAsymptoteFunction · 0.85
PathFromStringFunction · 0.85
ParseParametersMethod · 0.80
GetHelpMessageMethod · 0.80
GetArgMethod · 0.80
GetBoolArgMethod · 0.80
GetIntArgMethod · 0.80
formatFunction · 0.50

Tested by

no test coverage detected