mirror of
https://github.com/google/benchmark.git
synced 2025-03-14 03:10:22 +08:00
Use the benchmark's reported iteration count when estimating iterations for the next repetition, rather than the requested iteration count. When the benchmark uses KeepRunningBatch the actual iteration count can be larger than the one the runner requested. Prior to this fix the runner was underestimating the next iteration count, sometimes significantly so. Consider the case of a benchmark using a batch size of 1024. Prior to this change, the benchmark runner would attempt iteration counts 1, 10, 100 and 1000, yet the benchmark itself would do the same amount of work each time: a single batch of 1024 iterations. The discrepancy could also contribute to estimation errors once the benchmark time reached 10% of the target. For example, if the very first batch of 1024 iterations reached 10% of benchmark_min_min time, the runner would attempt to scale that to 100% from a basis of one iteration rather than 1024. This bug was particularly noticeable in benchmarks with large batch sizes, especially when the benchmark also had slow set up or tear down phases. With this fix in place it is possible to use KeepRunningBatch to achieve a kind of "minimum iteration count" feature by using a larger fixed batch size. For example, a benchmark may build a map of 500K elements and test a "find" operation. There is no point in running "find" just 1, 10, 100, etc., times. The benchmark can now pick a batch size of something like 10K, and the runner will arrive at the final max iteration count with in noticeably fewer repetitions. |
||
---|---|---|
.. | ||
args_product_test.cc | ||
AssemblyTests.cmake | ||
basic_test.cc | ||
benchmark_gtest.cc | ||
benchmark_name_gtest.cc | ||
benchmark_test.cc | ||
BUILD | ||
clobber_memory_assembly_test.cc | ||
CMakeLists.txt | ||
commandlineflags_gtest.cc | ||
complexity_test.cc | ||
cxx03_test.cc | ||
diagnostics_test.cc | ||
display_aggregates_only_test.cc | ||
donotoptimize_assembly_test.cc | ||
donotoptimize_test.cc | ||
filter_test.cc | ||
fixture_test.cc | ||
internal_threading_test.cc | ||
link_main_test.cc | ||
map_test.cc | ||
memory_manager_test.cc | ||
multiple_ranges_test.cc | ||
options_test.cc | ||
output_test_helper.cc | ||
output_test.h | ||
register_benchmark_test.cc | ||
report_aggregates_only_test.cc | ||
reporter_output_test.cc | ||
skip_with_error_test.cc | ||
state_assembly_test.cc | ||
statistics_gtest.cc | ||
string_util_gtest.cc | ||
templated_fixture_test.cc | ||
user_counters_tabular_test.cc | ||
user_counters_test.cc | ||
user_counters_thousands_test.cc |