Skip to content

Conversation

@Benjscho
Copy link

Add backwards conversion from protobuf Profile to Report, enabling roundtrip conversion between the two formats. This allows users to reconstruct Report objects from previously exported protobuf data, which is helpful for making flamegraphs.

Changes:

  • Add Report::from_pprof() method to convert protobuf Profile back to Report
  • Fix pprof() method to create one location per frame instead of per symbol
  • Group inlined functions correctly within locations per pprof spec
  • Add roundtrip conversion test

The changes make the protobuf output more standards-compliant by grouping inlined function symbols within the same location, which aligns with how Google's pprof tool expects the data to be structured.

@ti-chi-bot
Copy link

ti-chi-bot bot commented Aug 14, 2025

Welcome @Benjscho! It looks like this is your first PR to tikv/pprof-rs 🎉

Add backwards conversion from protobuf Profile to Report, enabling
roundtrip conversion between the two formats. This allows users to
reconstruct Report objects from previously exported protobuf data,
which is helpful for making flamegraphs.

Changes:
- Add Report::from_pprof() method to convert protobuf Profile back to Report
- Fix pprof() method to create one location per frame instead of per symbol
- Group inlined functions correctly within locations per pprof spec
- Add roundtrip conversion test

The changes make the protobuf output more standards-compliant by grouping
inlined function symbols within the same location, which aligns with how
Google's pprof tool expects the data to be structured.

Signed-off-by: Ben Schofield <[email protected]>
@Benjscho
Copy link
Author

@YangKeao would you be able to review?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant