Skip to content

Commit f8cc2b9

Browse files
committed
Merge #17267: bench: Fix negative values and zero for -evals flag
3bb0a46 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 3bb0a46 Tree-SHA512: 03cd4c7c55134c7ffd8cdb6ee993551ce41061a73e13c3c047247af9df1fd7ed07d798272b643ec864099036922aaadbdcd2b798d710406f48df60b9d5448c26
2 parents a259453 + 3bb0a46 commit f8cc2b9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/bench/bench_bitcoin.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ int main(int argc, char** argv)
5151
std::string scaling_str = gArgs.GetArg("-scaling", DEFAULT_BENCH_SCALING);
5252
bool is_list_only = gArgs.GetBoolArg("-list", false);
5353

54+
if (evaluations == 0) {
55+
return EXIT_SUCCESS;
56+
} else if (evaluations < 0) {
57+
tfm::format(std::cerr, "Error parsing evaluations argument: %d\n", evaluations);
58+
return EXIT_FAILURE;
59+
}
60+
5461
double scaling_factor;
5562
if (!ParseDouble(scaling_str, &scaling_factor)) {
5663
tfm::format(std::cerr, "Error parsing scaling factor as double: %s\n", scaling_str.c_str());

0 commit comments

Comments
 (0)