From 970b7574693eceab29dd4d0c2cc51aff08df996e Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Wed, 20 Sep 2023 18:49:33 +0200 Subject: [PATCH 1/3] Increase the kMaxIterations limit This fixes #1663. Note that as a result of this change, the columns in the console output can become misaligned if the actual iteration count is too high. This will be dealt with in a separate commit. --- src/benchmark_runner.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/benchmark_runner.cc b/src/benchmark_runner.cc index f7ae424397..dedfac03be 100644 --- a/src/benchmark_runner.cc +++ b/src/benchmark_runner.cc @@ -64,7 +64,7 @@ MemoryManager* memory_manager = nullptr; namespace { -static constexpr IterationCount kMaxIterations = 1000000000; +static constexpr IterationCount kMaxIterations = 1000000000000; const double kDefaultMinTime = std::strtod(::benchmark::kDefaultMinTimeStr, /*p_end*/ nullptr); From 3205b966a36a51a083a6356062cbc39c3f199f9b Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Tue, 17 Oct 2023 13:11:18 +0200 Subject: [PATCH 2/3] Fix failing test on Windows --- src/benchmark_runner.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/benchmark_runner.cc b/src/benchmark_runner.cc index dedfac03be..b5872c2f33 100644 --- a/src/benchmark_runner.cc +++ b/src/benchmark_runner.cc @@ -325,7 +325,7 @@ IterationCount BenchmarkRunner::PredictNumItersNeeded( // So what seems to be the sufficiently-large iteration count? Round up. const IterationCount max_next_iters = static_cast( - std::lround(std::max(multiplier * static_cast(i.iters), + std::llround(std::max(multiplier * static_cast(i.iters), static_cast(i.iters) + 1.0))); // But we do have *some* limits though.. const IterationCount next_iters = std::min(max_next_iters, kMaxIterations); From 7a68cb8e8822d650f1aefb08059ac1dd4b79bcbc Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Tue, 17 Oct 2023 13:13:09 +0200 Subject: [PATCH 3/3] Fix formatting --- src/benchmark_runner.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/benchmark_runner.cc b/src/benchmark_runner.cc index b5872c2f33..f5cd3e644b 100644 --- a/src/benchmark_runner.cc +++ b/src/benchmark_runner.cc @@ -326,7 +326,7 @@ IterationCount BenchmarkRunner::PredictNumItersNeeded( // So what seems to be the sufficiently-large iteration count? Round up. const IterationCount max_next_iters = static_cast( std::llround(std::max(multiplier * static_cast(i.iters), - static_cast(i.iters) + 1.0))); + static_cast(i.iters) + 1.0))); // But we do have *some* limits though.. const IterationCount next_iters = std::min(max_next_iters, kMaxIterations);