MCPcopy Create free account
hub / github.com/Icinga/icinga2 / check_memory

Function check_memory

plugins/check_memory.cpp:182–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182static int check_memory(printInfoStruct& printInfo)
183{
184 if (l_Debug)
185 std::wcout << L"Accessing memory statistics via MemoryStatus" << '\n';
186
187 MEMORYSTATUSEX memBuf;
188 memBuf.dwLength = sizeof(memBuf);
189 GlobalMemoryStatusEx(&memBuf);
190
191 printInfo.tRam = round((memBuf.ullTotalPhys / pow(1024.0, printInfo.unit) * pow(10.0, printInfo.unit))) / pow(10.0, printInfo.unit);
192 printInfo.aRam = round((memBuf.ullAvailPhys / pow(1024.0, printInfo.unit) * pow(10.0, printInfo.unit))) / pow(10.0, printInfo.unit);
193 printInfo.percentFree = 100.0 * memBuf.ullAvailPhys / memBuf.ullTotalPhys;
194
195 if (l_Debug)
196 std::wcout << L"Found memBuf.dwTotalPhys: " << memBuf.ullTotalPhys << '\n'
197 << L"Found memBuf.dwAvailPhys: " << memBuf.ullAvailPhys << '\n';
198
199 return -1;
200}
201
202int wmain(int argc, WCHAR **argv)
203{

Callers 1

wmainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected