0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-03-06 14:19:59 -05:00

Merge #17267: bench: Fix negative values and zero for -evals flag

3bb0a4674f bench: Fix negative values and zero for -evals flag (nijynot)

Pull request description:

  This PR makes `bench_bitcoin -evals=0` evaluate at once and throws when `-evals` is a negative integer.

  ---

  Currently when you run `bench_bitcoin -evals=0`, it'll get stuck at
  ```
  # Benchmark, evals, iterations, total, min, max, median
  ```
  . This is not intuitively expected and should instead evaluate instantly as it's set to zero. Negative integers for `-evals` does not make sense either and should throw if set.

ACKs for top commit:
  laanwj:
    ACK 3bb0a4674f

Tree-SHA512: 03cd4c7c55134c7ffd8cdb6ee993551ce41061a73e13c3c047247af9df1fd7ed07d798272b643ec864099036922aaadbdcd2b798d710406f48df60b9d5448c26
This commit is contained in:
Wladimir J. van der Laan 2019-10-28 14:14:07 +01:00
commit f8cc2b967b
No known key found for this signature in database
GPG key ID: 1E4AED62986CD25D

View file

@ -51,6 +51,13 @@ int main(int argc, char** argv)
std::string scaling_str = gArgs.GetArg("-scaling", DEFAULT_BENCH_SCALING);
bool is_list_only = gArgs.GetBoolArg("-list", false);
if (evaluations == 0) {
return EXIT_SUCCESS;
} else if (evaluations < 0) {
tfm::format(std::cerr, "Error parsing evaluations argument: %d\n", evaluations);
return EXIT_FAILURE;
}
double scaling_factor;
if (!ParseDouble(scaling_str, &scaling_factor)) {
tfm::format(std::cerr, "Error parsing scaling factor as double: %s\n", scaling_str.c_str());