Add opt-in cross-thread statistics for multithreaded runs - #2293
Add opt-in cross-thread statistics for multithreaded runs#2293Frank20021 wants to merge 1 commit into
Conversation
Keep the existing summed counter row unchanged, and when requested report mean/median/stddev/cv across threads so fairness is visible.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
| bool report_thread_statistics_specified_; | ||
| bool report_thread_statistics_; |
There was a problem hiding this comment.
do we need both? if the default is false does it matter if it's specified or not?
| } | ||
|
|
||
| Benchmark* Benchmark::ReportThreadStatistics(bool value) { | ||
| report_thread_statistics_specified_ = true; |
There was a problem hiding this comment.
how does this interact with other per benchmark settings? do we need to make sure that the user hasn't set incompatible flags?
|
|
||
| const IterationCount thread_iters = thread_results.front().iterations; | ||
|
|
||
| for (const auto& tr : thread_results) { |
There was a problem hiding this comment.
this looks like code we have elsewhere. is there any opportunity to share the code instead of duplicating it?
| bool warmup_done; | ||
| const int repeats; | ||
| const bool has_explicit_iteration_count; | ||
| const bool report_thread_statistics; |
| @@ -0,0 +1,230 @@ | |||
|
|
|||
| #undef NDEBUG | |||
Summary
Finish) counter row is unchanged. ExtraRT_Aggregaterows use athread_prefix so they do not collide with repetition_mean/_median/_stddev/_cv.->ReportThreadStatistics()or--benchmark_report_thread_statistics=true. Per-thread samples are captured inRunInThreadbeforeIncrement;ComputeStatsstill only sees iteration runs.Test plan
thread_statistics_test(unequal{1,2,3}counters,kAvgThreads, feature off,threads:1)user_counters_threads_testrepetitions_test --benchmark_repetitions=3Fixes #1902
AI usage: I used Cursor as a coding assistant to locate the runner/reporter paths and draft this change. I reviewed the capture/
Finish/ComputeStatswiring and the tests myself.