Skip to content

Commit

Permalink
Increase the kMaxIterations limit (#1668)
Browse files Browse the repository at this point in the history
* 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.

* Fix failing test on Windows

* Fix formatting

---------

Co-authored-by: dominic <[email protected]>
  • Loading branch information
andreas-abel and dmah42 authored Oct 17, 2023
1 parent 365bf76 commit f30c99a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/benchmark_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -325,8 +325,8 @@ IterationCount BenchmarkRunner::PredictNumItersNeeded(

// So what seems to be the sufficiently-large iteration count? Round up.
const IterationCount max_next_iters = static_cast<IterationCount>(
std::lround(std::max(multiplier * static_cast<double>(i.iters),
static_cast<double>(i.iters) + 1.0)));
std::llround(std::max(multiplier * static_cast<double>(i.iters),
static_cast<double>(i.iters) + 1.0)));
// But we do have *some* limits though..
const IterationCount next_iters = std::min(max_next_iters, kMaxIterations);

Expand Down

0 comments on commit f30c99a

Please sign in to comment.