fix(memory): provide better free memory approximation on old kernels

The approximation should include SReclaimable, and subtract Shmem. To
prevent the parsing code from ballooning in size, this commit also
refactors the parsing into a map.
This commit is contained in:
Tudor Brindus
2020-03-20 17:37:22 -04:00
parent 37b1b35035
commit 19743f3085
2 changed files with 20 additions and 24 deletions

View File

@ -17,8 +17,7 @@ class Memory : public ALabel {
static inline const std::string data_dir_ = "/proc/meminfo";
void parseMeminfo();
unsigned long memtotal_;
unsigned long memfree_;
std::unordered_map<std::string, unsigned long> meminfo_;
util::SleeperThread thread_;
};