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