Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify how Read and read_value types are exposed #19

Merged
merged 3 commits into from
May 14, 2023
Merged

Conversation

Phantomical
Copy link
Owner

As it turns out, PERF_RECORD_READ events are only emitted when the inherit and inherit_stat flags are set. inherit is incompatible with READ_FORMAT_GROUP so PERF_RECORD_READ will never be emitted with a group format. This PR takes advantage of that to simplify some things and I've also gone and rethought how ReadGroup and ReadValue should be used.

  • Sample now always contains a ReadGroup and converts if the source read_format is only for a single value.
  • Read now only contains a ReadValue since it is not possible to create a Read record when GROUP is set in read_format
  • ReadGroup can now be converted into ReadValue via TryFrom
  • ReadValue can now be converted into ReadGroup via From
  • ReadData has been deleted since the conversions take its place

As it turns out, PERF_RECORD_READ events are only emitted when the
inherit and inherit_stat flags are set. inherit is incompatible with
READ_FORMAT_GROUP so PERF_RECORD_READ will never be emitted with a group
format.

This doesn't mean we can delete all the code around reading group data
because they are still used within PERF_RECORD_SAMPLE.
- Sample now always contains a ReadGroup and converts if the source
  read_format is only for a single value.
- Read now only contains a ReadValue since it is not possible to create
  a Read record when GROUP is set in read_format
- ReadGroup can now be converted into ReadValue via TryFrom
- ReadValue can now be converted into ReadGroup via From
- ReadData has been deleted since the conversions take its place
@Phantomical Phantomical merged commit aabc090 into master May 14, 2023
@Phantomical Phantomical deleted the simpler-read branch May 14, 2023 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant