Skip to content

Commit fa46aeb

Browse files
author
MarcoFalke
committed
scripted-diff: Replace gArgs with local argsman in bench
-BEGIN VERIFY SCRIPT- sed -i -e 's/gArgs/argsman/g' src/bench/bench_bitcoin.cpp -END VERIFY SCRIPT-
1 parent fa2bc41 commit fa46aeb

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

src/bench/bench_bitcoin.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,38 +19,38 @@ static const int64_t DEFAULT_PLOT_HEIGHT = 768;
1919

2020
static void SetupBenchArgs(ArgsManager& argsman)
2121
{
22-
SetupHelpOptions(gArgs);
23-
24-
gArgs.AddArg("-list", "List benchmarks without executing them. Can be combined with -scaling and -filter", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
25-
gArgs.AddArg("-evals=<n>", strprintf("Number of measurement evaluations to perform. (default: %u)", DEFAULT_BENCH_EVALUATIONS), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
26-
gArgs.AddArg("-filter=<regex>", strprintf("Regular expression filter to select benchmark by name (default: %s)", DEFAULT_BENCH_FILTER), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
27-
gArgs.AddArg("-scaling=<n>", strprintf("Scaling factor for benchmark's runtime (default: %u)", DEFAULT_BENCH_SCALING), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
28-
gArgs.AddArg("-printer=(console|plot)", strprintf("Choose printer format. console: print data to console. plot: Print results as HTML graph (default: %s)", DEFAULT_BENCH_PRINTER), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
29-
gArgs.AddArg("-plot-plotlyurl=<uri>", strprintf("URL to use for plotly.js (default: %s)", DEFAULT_PLOT_PLOTLYURL), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
30-
gArgs.AddArg("-plot-width=<x>", strprintf("Plot width in pixel (default: %u)", DEFAULT_PLOT_WIDTH), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
31-
gArgs.AddArg("-plot-height=<x>", strprintf("Plot height in pixel (default: %u)", DEFAULT_PLOT_HEIGHT), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
22+
SetupHelpOptions(argsman);
23+
24+
argsman.AddArg("-list", "List benchmarks without executing them. Can be combined with -scaling and -filter", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
25+
argsman.AddArg("-evals=<n>", strprintf("Number of measurement evaluations to perform. (default: %u)", DEFAULT_BENCH_EVALUATIONS), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
26+
argsman.AddArg("-filter=<regex>", strprintf("Regular expression filter to select benchmark by name (default: %s)", DEFAULT_BENCH_FILTER), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
27+
argsman.AddArg("-scaling=<n>", strprintf("Scaling factor for benchmark's runtime (default: %u)", DEFAULT_BENCH_SCALING), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
28+
argsman.AddArg("-printer=(console|plot)", strprintf("Choose printer format. console: print data to console. plot: Print results as HTML graph (default: %s)", DEFAULT_BENCH_PRINTER), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
29+
argsman.AddArg("-plot-plotlyurl=<uri>", strprintf("URL to use for plotly.js (default: %s)", DEFAULT_PLOT_PLOTLYURL), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
30+
argsman.AddArg("-plot-width=<x>", strprintf("Plot width in pixel (default: %u)", DEFAULT_PLOT_WIDTH), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
31+
argsman.AddArg("-plot-height=<x>", strprintf("Plot height in pixel (default: %u)", DEFAULT_PLOT_HEIGHT), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
3232
}
3333

3434
int main(int argc, char** argv)
3535
{
3636
ArgsManager argsman;
3737
SetupBenchArgs(argsman);
3838
std::string error;
39-
if (!gArgs.ParseParameters(argc, argv, error)) {
39+
if (!argsman.ParseParameters(argc, argv, error)) {
4040
tfm::format(std::cerr, "Error parsing command line arguments: %s\n", error);
4141
return EXIT_FAILURE;
4242
}
4343

44-
if (HelpRequested(gArgs)) {
45-
std::cout << gArgs.GetHelpMessage();
44+
if (HelpRequested(argsman)) {
45+
std::cout << argsman.GetHelpMessage();
4646

4747
return EXIT_SUCCESS;
4848
}
4949

50-
int64_t evaluations = gArgs.GetArg("-evals", DEFAULT_BENCH_EVALUATIONS);
51-
std::string regex_filter = gArgs.GetArg("-filter", DEFAULT_BENCH_FILTER);
52-
std::string scaling_str = gArgs.GetArg("-scaling", DEFAULT_BENCH_SCALING);
53-
bool is_list_only = gArgs.GetBoolArg("-list", false);
50+
int64_t evaluations = argsman.GetArg("-evals", DEFAULT_BENCH_EVALUATIONS);
51+
std::string regex_filter = argsman.GetArg("-filter", DEFAULT_BENCH_FILTER);
52+
std::string scaling_str = argsman.GetArg("-scaling", DEFAULT_BENCH_SCALING);
53+
bool is_list_only = argsman.GetBoolArg("-list", false);
5454

5555
if (evaluations == 0) {
5656
return EXIT_SUCCESS;
@@ -66,15 +66,15 @@ int main(int argc, char** argv)
6666
}
6767

6868
std::unique_ptr<benchmark::Printer> printer = MakeUnique<benchmark::ConsolePrinter>();
69-
std::string printer_arg = gArgs.GetArg("-printer", DEFAULT_BENCH_PRINTER);
69+
std::string printer_arg = argsman.GetArg("-printer", DEFAULT_BENCH_PRINTER);
7070
if ("plot" == printer_arg) {
7171
printer.reset(new benchmark::PlotlyPrinter(
72-
gArgs.GetArg("-plot-plotlyurl", DEFAULT_PLOT_PLOTLYURL),
73-
gArgs.GetArg("-plot-width", DEFAULT_PLOT_WIDTH),
74-
gArgs.GetArg("-plot-height", DEFAULT_PLOT_HEIGHT)));
72+
argsman.GetArg("-plot-plotlyurl", DEFAULT_PLOT_PLOTLYURL),
73+
argsman.GetArg("-plot-width", DEFAULT_PLOT_WIDTH),
74+
argsman.GetArg("-plot-height", DEFAULT_PLOT_HEIGHT)));
7575
}
7676

77-
gArgs.ClearArgs(); // gArgs no longer needed. Clear it here to avoid interactions with the testing setup in the benches
77+
argsman.ClearArgs(); // argsman no longer needed. Clear it here to avoid interactions with the testing setup in the benches
7878

7979
benchmark::BenchRunner::RunAll(*printer, evaluations, scaling_factor, regex_filter, is_list_only);
8080

0 commit comments

Comments
 (0)