34 lines
932 B
C++
34 lines
932 B
C++
/*Ковалев Р.Е. 2021. rekovalev.site*/
|
||
|
||
#ifdef __linux__
|
||
#include <sys/sysinfo.h>
|
||
#elif _WIN32
|
||
#include <windows.h>
|
||
#endif
|
||
|
||
/*Класс для работы с информацией об оперативной памяти*/
|
||
class Memorator
|
||
{
|
||
public:
|
||
static unsigned long long getTotalRam_B();
|
||
static unsigned long long getTotalRam_KB();
|
||
static unsigned long long getTotalRam_MB();
|
||
static unsigned long long getFreeRam_B();
|
||
static unsigned long long getFreeRam_KB();
|
||
static unsigned long long getFreeRam_MB();
|
||
static unsigned long long getTotalSwap_B();
|
||
static unsigned long long getTotalSwap_KB();
|
||
static unsigned long long getTotalSwap_MB();
|
||
static unsigned long long getFreeSwap_B();
|
||
static unsigned long long getFreeSwap_KB();
|
||
static unsigned long long getFreeSwap_MB();
|
||
|
||
private:
|
||
static void ask();
|
||
#ifdef __linux__
|
||
static struct sysinfo info;
|
||
#elif _WIN32
|
||
static MEMORYSTATUSEX statex;
|
||
#endif
|
||
};
|