From e0105a0902a72297fd0d01110d9b32eea952cb1a Mon Sep 17 00:00:00 2001 From: ColumbusTech Date: Fri, 24 Nov 2017 21:47:15 +0300 Subject: [PATCH] Getting RAM Size --- Info.hpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Info.hpp b/Info.hpp index 7443c1e..47156ca 100644 --- a/Info.hpp +++ b/Info.hpp @@ -1,13 +1,18 @@ #include #include #include -#include + +#ifdef __linux__ + #include +#endif namespace Columbus { int GetCPUCount(); int GetCPUCacheSize(); + unsigned long GetRAMSize(); + unsigned long GetRamAvaliable(); int GetCPUCount() { @@ -52,6 +57,15 @@ namespace Columbus #endif } + unsigned long GetRAMSize() + { + #ifdef __linux__ + struct sysinfo info; + if (sysinfo(&info) == -1) return 0; + return info.totalram; + #endif + } + }