17 explicit memoryLoad(std::string memInfo =
"/proc/meminfo",
18 std::string memInfoOfProcess =
"/proc/self/status",
19 std::string memInfoOfProcessPrefix =
"/proc/self/") :
21 currentMemoryUsageInKB(0),
22 memInfoFile(
std::move(memInfo)),
23 memInfoOfProcessFile(
std::move(memInfoOfProcess)),
24 memInfoOfProcessPrefixFile(
std::move(memInfoOfProcessPrefix)){};
53 bool parseMemoryFile();
54 static uint64_t parseProcessMemoryFile(std::string fileToParse);
55 uint64_t totalMemoryInKB;
56 uint64_t currentMemoryUsageInKB;
57 std::string memInfoFile;
58 std::string memInfoOfProcessFile;
59 std::string memInfoOfProcessPrefixFile;
60 std::chrono::time_point<std::chrono::steady_clock> timeStamp;
uint64_t getTotalMemoryInKB()
get total memory of the system in KB
uint64_t getMemoryUsageByThisProcess()
get memory usage of this process (self)
memoryLoad(std::string memInfo="/proc/meminfo", std::string memInfoOfProcess="/proc/self/status", std::string memInfoOfProcessPrefix="/proc/self/")
float getCurrentMemUsageInPercent()
get current memory usage of the system in percent 0-100%
uint64_t getCurrentMemUsageInKB()
get current Memory Usage of the system in KB
static uint64_t getMemoryUsedByProcess(int pid)
get the current memory usage of a process