Getting RAM Size

master
ColumbusTech 2017-11-24 21:47:15 +03:00
parent 605d39d72a
commit e0105a0902
1 changed files with 15 additions and 1 deletions

View File

@ -1,13 +1,18 @@
#include <cstdlib>
#include <fstream>
#include <string>
#include <iostream>
#ifdef __linux__
#include <sys/sysinfo.h>
#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
}
}