21 #include <sys/sysctl.h>
22 #include <sys/types.h>
26 int mib[] = {CTL_HW, HW_MEMSIZE};
28 size_t length =
sizeof(value);
30 if (-1 == sysctl(mib, 2, &value, &length, NULL, 0)) {
37#elif (defined(linux) || defined(__linux__) || defined(__linux)) \
38 || (defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) \
39 || defined(__OpenBSD__))
41 #include <sys/sysinfo.h>
std::optional< std::size_t > getPhysicalMemory()
Get the amount of physical memory (RAM) available on the system, in bytes.
void info(std::string module_name, Types... var2)
Prints a log message with multiple arguments.