eminence / procfs

Rust library for reading the Linux procfs filesystem
Other
367 stars 106 forks source link

Make it possible to get cpuinfo from another file. #117

Closed rjbergTU closed 3 years ago

rjbergTU commented 3 years ago

I think it would be a good idea if cpuinfo could be collected from another source than the hardcoded /proc/cpuinfo.

For example, if I want to parse a file I got from another system I could use this to process the information. It can also help with integration testing, because I would be able to set a cpuinfo other than the one on the currently running system for testing.

I made a PR for this already:

https://github.com/eminence/procfs/pull/116

Thanks in advance for considering this.

eminence commented 3 years ago

hi! Sorry for taking so long to reply. I think your idea is a good one, and I think your PR is the right approach. I actually think this approach should be taken more broadly for other structs to make it possible to parse data from custom sources (files mounted outside of /proc for example)

rjbergTU commented 3 years ago

I added this to Meminfo and KernelStats as well.

Could you merge it? Something I am working on is already using this functionality.

rjbergTU commented 3 years ago

It is merged, so I am closing this issue.