Commit 6e393336 authored by Jan Möbius's avatar Jan Möbius
Browse files

Main memory info for Windows

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@17838 383ad7c9-94d9-4d36-a494-682f7c89f535
parent f2f0e2ca
......@@ -104,11 +104,9 @@ void MemInfoPlugin::pluginsInitialized() {
}
// Main Memory information
#ifdef WIN32 //Windows
#elif defined ARCH_DARWIN // Apple
#ifdef ARCH_DARWIN //Apple
#else // Linux
#else // Linux and Windows
//emit log(LOGINFO,"Linux Main Memory monitoring supported, installing main memory monitor into status bar");
......@@ -152,28 +150,35 @@ void MemInfoPlugin::cpuMemoryInfoUpdate() {
if (mainMemBar_) {
unsigned long totalRamMB = 0;
unsigned long freeRamMB = 0;
// Main Memory information
#ifdef WIN32 //Windows
// Define memory structure
MEMORYSTATUSEX ms;
// Set the size ( required according to spec ... why???? )
ms.dwLength = sizeof (ms);
// Get the info
GlobalMemoryStatusEx(&ms);
totalRamMB = ms.ullAvailPhys/1024/1024;
freeRamMB = ms.ullAvailPhys/1024/1024;
#elif defined ARCH_DARWIN // Apple
#else // Linux
struct sysinfo sys_info;
sysinfo(&sys_info);
// Unit in bytes ; /1024 -> KB ; /1024 MB
unsigned long totalRamMB = sys_info.totalram / 1024 /1024 * sys_info.mem_unit;
// Unit in bytes ; /1024 -> KB ; /1024 MB
unsigned long freeRamMB = sys_info.freeram / 1024 / 1024 * sys_info.mem_unit;
totalRamMB = sys_info.totalram / 1024 / 1024 * sys_info.mem_unit;
freeRamMB = sys_info.freeram / 1024 / 1024 * sys_info.mem_unit;
#endif
mainMemBar_->setRange( 0 , totalRamMB );
mainMemBar_->setValue( totalRamMB-freeRamMB);
#endif
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment