Skip to content

Commit

Permalink
enable bm_estimate_time to accept bm_max_secs (#2354)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #2354

Currently, if we enable `bm_estimate_time`, the max benchmark time is 5 seconds. We should allow users to increase it by tuning bm_max_secs

Reviewed By: Gownta

Differential Revision: D67150918

fbshipit-source-id: 4f23e83d39b11581bff4e5c1c67d2b2e159acbef
  • Loading branch information
Zhijian Jiang authored and facebook-github-bot committed Dec 14, 2024
1 parent 32dba70 commit 889f0ad
Showing 1 changed file with 2 additions and 2 deletions.
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

0 comments on commit 889f0ad

Please sign in to comment.