Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable bm_estimate_time to accept bm_max_secs #2354

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions folly/Benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,11 @@ static std::pair<double, UserCounters> runBenchmarkGetNSPerIterationEstimate(
size_t actualTrials = 0;
const unsigned int estimateCount = to_integral(max(1.0, 5e+7 / estPerIter));
std::vector<TrialResultType> trialResults(FLAGS_bm_max_trials);
const auto maxRunTime = seconds(5);
const auto maxRunTime = seconds(max(5, FLAGS_bm_max_secs));
auto globalStart = high_resolution_clock::now();

// Run benchmark up to trial times with at least 0.5 sec each
// Or until we run out of alowed time (5sec)
// Or until we run out of allowed time (max(5, FLAGS_bm_max_secs))
for (size_t tryId = 0; tryId < FLAGS_bm_max_trials; tryId++) {
detail::TimeIterData timeIterData = fun(estimateCount);
auto nsecs = duration_cast<nanoseconds>(timeIterData.duration);
Expand Down