rust-jemalloc-pprof
rust-jemalloc-pprof copied to clipboard
Support parsing existing jemalloc profile /proc/id/maps section
Right now parse_jeheap uses MAPPINGS to populate mapping information:
https://github.com/polarsignals/rust-jemalloc-pprof/blob/07bc78af6487af7b31d057e02d5fabd46a024c5f/pure/src/lib.rs#L318-L322
When using parse_jeheap on an existing file, this still collects mappings for the running process:
https://github.com/polarsignals/rust-jemalloc-pprof/blob/07bc78af6487af7b31d057e02d5fabd46a024c5f/pure/src/linux.rs#L44-L152
When profiling is enabled and disabled inline, this makes sense. However, for an existing jemalloc profile, this is counter-intuitive, because the returned mappings are not actually generated from the heap file.
For example, if this method is run on an existing heap file, the returned mappings will be different each time, and do not actually match what exists in the file.
It would be great to support parsing the /proc/id/maps output from the .heap file.
Can you explain the use case a bit? Are you looking to extract the profile from outside of the process? What would you expect the API to look like?
cc @umanwizard
If I understand correctly, @Rjected wants to use the library to parse unrelated jeheap files from other processes and transform them to pprof, which requires a way to provide the mappings. I think we can support this, I'll look into it later this week (Friday)
If I understand correctly, @Rjected wants to use the library to parse unrelated jeheap files from other processes and transform them to pprof, which requires a way to provide the mappings. I think we can support this, I'll look into it later this week (Friday)
Yep that's exactly it! although I'm attempting to analyze them in the firefox profiler instead of pprof, like this: https://share.firefox.dev/3PIeyE6
I did some thinking on what would be required to support this (for linux only for now):
- proc maps parsing, from a
Linesstruct - could be done in thersprocmapscrate - parsing of the elf note header for the population of the debug id. I'm not sure how comfortable I am parsing ELF headers by hand, so I would use a crate for this
Hi @Rjected ,
Sorry for the long delay on this. In the latest version, you can pass the mappings of your choice to parse_jeheap.