feat: Add opt-in cross-thread statistics for multithreaded counters#2182
Open
shreejaykurhade wants to merge 3 commits intogoogle:mainfrom
Open
feat: Add opt-in cross-thread statistics for multithreaded counters#2182shreejaykurhade wants to merge 3 commits intogoogle:mainfrom
shreejaykurhade wants to merge 3 commits intogoogle:mainfrom
Conversation
Contributor
Author
|
@dmah42 please review |
Member
|
is anyone asking for this? i'm beginning to think you've pointed an agent at the codebase and asked it to come up with "improvements". |
Contributor
Author
|
Yes, this is intended to address #1902, which asks for cross-thread statistics to inspect fairness/imbalance in multithreaded counters. I do use Codex to understand parts of the codebase (e.g., structure and JSON fields), but the design and implementation here are deliberate. The change is opt-in and doesn’t affect existing behavior. Happy to adjust if needed. |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR addresses #1902 by enabling visibility into cross-thread imbalance in multithreaded counters.
Currently, only aggregated (summed) counter values are reported, which makes it difficult to assess fairness across benchmark-created threads. This change introduces an opt-in mechanism to compute and report distribution statistics across threads.
When enabled, benchmark-created thread counter values are retained long enough to compute the benchmark’s configured statistics across threads. The existing summed counter row remains unchanged, and additional aggregate rows:
_thread_mean_thread_median_thread_stddev_thread_cvFor example, if three benchmark threads report
workvalues1,2, and3, the normal row still reportswork=6, while the opt-in thread-stat rows report mean2, median2, stddev1, and cv50%.Testing
cmake --build buildcmake --build build --config Debugctest --test-dir build --output-on-failureAll 74 CTest tests pass.