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

feat: add from_lines method #17

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Rjected
Copy link

@Rjected Rjected commented May 20, 2024

This was motivated by an existing use case: parsing jemalloc memory profiles, for example like in rust-jemalloc-pprof. When parsing jemalloc memory profiles, the output of /proc/self/maps is included at the bottom of the file. Jemalloc profiles can be easily parsed using .lines(), so we already have a Lines data structure.

Providing a from_lines method, like the from_str method, would make parsing the proc maps from the profile extremely easy. Let me know what you think!

This would be consumed like this:

    // Parse the mappings from the file
    let maps = rsprocmaps::from_lines(lines);
    for map in maps {
        let map = map?;
        // ...
    }

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.

None yet

1 participant