| 22 | } |
| 23 | |
| 24 | void waybar::modules::Memory::parseMeminfo() { |
| 25 | const std::string data_dir_ = "/proc/meminfo"; |
| 26 | std::ifstream info(data_dir_); |
| 27 | if (!info.is_open()) { |
| 28 | throw std::runtime_error("Can't open " + data_dir_); |
| 29 | } |
| 30 | std::string line; |
| 31 | while (getline(info, line)) { |
| 32 | auto posDelim = line.find(':'); |
| 33 | if (posDelim == std::string::npos) { |
| 34 | continue; |
| 35 | } |
| 36 | |
| 37 | std::string name = line.substr(0, posDelim); |
| 38 | int64_t value = std::stol(line.substr(posDelim + 1)); |
| 39 | meminfo_[name] = value; |
| 40 | } |
| 41 | |
| 42 | meminfo_["zfs_size"] = zfsArcSize(); |
| 43 | } |
nothing calls this directly
no test coverage detected