From 38b00beb2148314db50f904f2f02503447aedff6 Mon Sep 17 00:00:00 2001 From: Zhijian Jiang Date: Fri, 13 Dec 2024 20:34:39 -0800 Subject: [PATCH] enable bm_estimate_time to accept bm_max_secs (#2354) Summary: 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 --- folly/Benchmark.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/folly/Benchmark.cpp b/folly/Benchmark.cpp index 081a281a026..a868b7f48bf 100644 --- a/folly/Benchmark.cpp +++ b/folly/Benchmark.cpp @@ -263,11 +263,11 @@ static std::pair runBenchmarkGetNSPerIterationEstimate( size_t actualTrials = 0; const unsigned int estimateCount = to_integral(max(1.0, 5e+7 / estPerIter)); std::vector 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(timeIterData.duration);