mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-03 09:56:38 -05:00
bench: surround main() execution with try/catch
so we have a cleaner exit on internal runtime errors. e.g. an unknown priority level.
This commit is contained in:
parent
3da7cd2a76
commit
466b54bd4a
1 changed files with 16 additions and 11 deletions
|
@ -118,17 +118,22 @@ int main(int argc, char** argv)
|
|||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
benchmark::Args args;
|
||||
args.asymptote = parseAsymptote(argsman.GetArg("-asymptote", ""));
|
||||
args.is_list_only = argsman.GetBoolArg("-list", false);
|
||||
args.min_time = std::chrono::milliseconds(argsman.GetIntArg("-min-time", DEFAULT_MIN_TIME_MS));
|
||||
args.output_csv = argsman.GetPathArg("-output-csv");
|
||||
args.output_json = argsman.GetPathArg("-output-json");
|
||||
args.regex_filter = argsman.GetArg("-filter", DEFAULT_BENCH_FILTER);
|
||||
args.sanity_check = argsman.GetBoolArg("-sanity-check", false);
|
||||
args.priority = parsePriorityLevel(argsman.GetArg("-priority-level", DEFAULT_PRIORITY));
|
||||
try {
|
||||
benchmark::Args args;
|
||||
args.asymptote = parseAsymptote(argsman.GetArg("-asymptote", ""));
|
||||
args.is_list_only = argsman.GetBoolArg("-list", false);
|
||||
args.min_time = std::chrono::milliseconds(argsman.GetIntArg("-min-time", DEFAULT_MIN_TIME_MS));
|
||||
args.output_csv = argsman.GetPathArg("-output-csv");
|
||||
args.output_json = argsman.GetPathArg("-output-json");
|
||||
args.regex_filter = argsman.GetArg("-filter", DEFAULT_BENCH_FILTER);
|
||||
args.sanity_check = argsman.GetBoolArg("-sanity-check", false);
|
||||
args.priority = parsePriorityLevel(argsman.GetArg("-priority-level", DEFAULT_PRIORITY));
|
||||
|
||||
benchmark::BenchRunner::RunAll(args);
|
||||
benchmark::BenchRunner::RunAll(args);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
return EXIT_SUCCESS;
|
||||
} catch (const std::exception& e) {
|
||||
tfm::format(std::cerr, "Error: %s\n", e.what());
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue