sysinfo: add memory stats for posix platforms

This commit is contained in:
Danny Robson 2019-06-20 12:46:39 +10:00
parent c79b0bae22
commit e73d42e817

View File

@ -40,5 +40,13 @@ cruft::util::operator<< (std::ostream &os, sysinfo const &)
os << ", username: " << user->pw_name;
}
{
auto const size = posix::error::try_call (sysconf, _SC_PAGESIZE);
auto const total = posix::error::try_call (sysconf, _SC_PHYS_PAGES);
auto const now = posix::error::try_call (sysconf, _SC_AVPHYS_PAGES);
os << ", ram: { total: " << size * total << ", available: " << size * now << " },";
}
return os << " }";
}