Getting RAM Size
parent
605d39d72a
commit
e0105a0902
16
Info.hpp
16
Info.hpp
|
|
@ -1,13 +1,18 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
|
||||||
|
#ifdef __linux__
|
||||||
|
#include <sys/sysinfo.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Columbus
|
namespace Columbus
|
||||||
{
|
{
|
||||||
|
|
||||||
int GetCPUCount();
|
int GetCPUCount();
|
||||||
int GetCPUCacheSize();
|
int GetCPUCacheSize();
|
||||||
|
unsigned long GetRAMSize();
|
||||||
|
unsigned long GetRamAvaliable();
|
||||||
|
|
||||||
int GetCPUCount()
|
int GetCPUCount()
|
||||||
{
|
{
|
||||||
|
|
@ -52,6 +57,15 @@ namespace Columbus
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned long GetRAMSize()
|
||||||
|
{
|
||||||
|
#ifdef __linux__
|
||||||
|
struct sysinfo info;
|
||||||
|
if (sysinfo(&info) == -1) return 0;
|
||||||
|
return info.totalram;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue