MCPcopy Create free account
hub / github.com/Alexays/Waybar / parseMeminfo

Method parseMeminfo

src/modules/memory/linux.cpp:24–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22}
23
24void 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}

Callers

nothing calls this directly

Calls 1

zfsArcSizeFunction · 0.85

Tested by

no test coverage detected