Repository navigation
Conversation
A benchmark could only see its own function name, thread count and thread index. Which registration it came from, which instance of that registration it is, and which repetition is executing were known to the library -- they are in every reported Run -- but not reachable from the benchmark itself, so code that wants a location of its own to work in, or wants to act only on the first or last repetition, had nowhere to get that from. Expose them on State as family_index(), per_family_instance_index(), repetition_index() and repetitions(), carrying the same values the reporters emit for that run. The repetition index and count come from the runner rather than the instance, since the total is the resolved one (--benchmark_repetitions when the registration does not set it). Setup/Teardown callbacks get them too; they already run once per repetition. Adds state_indices_gtest, which registers two families -- one of them with two argument sets -- and checks that the values seen inside the benchmark and in the Setup/Teardown callbacks match those the reporter receives. Note this grows State by four ints, so it is an ABI change for anyone linking the shared library.
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.
A benchmark could only see its own function name, thread count and thread index. Which registration it came from, which instance of that registration it is, and which repetition is executing were known to the library -- they are in every reported Run -- but not reachable from the benchmark itself, so code that wants a location of its own to work in, or wants to act only on the first or last repetition, had nowhere to get that from.
Expose them on State as family_index(), per_family_instance_index(), repetition_index() and repetitions(), carrying the same values the reporters emit for that run. The repetition index and count come from the runner rather than the instance, since the total is the resolved one (--benchmark_repetitions when the registration does not set it). Setup/Teardown callbacks get them too; they already run once per repetition.
Adds state_indices_gtest, which registers two families -- one of them with two argument sets -- and checks that the values seen inside the benchmark and in the Setup/Teardown callbacks match those the reporter receives.
Note this grows State by four ints, so it is an ABI change for anyone linking the shared library.