Getting RAM Size
parent
605d39d72a
commit
e0105a0902
16
Info.hpp
16
Info.hpp
|
|
@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue