Partially reverted cbee39e

This commit is contained in:
Birunthan Mohanathas 2012-08-15 21:14:22 +03:00
parent 7e627cf5f3
commit 1c59a717fe
2 changed files with 20 additions and 18 deletions

View File

@ -47,12 +47,17 @@ CMeasureMemory::~CMeasureMemory()
*/ */
void CMeasureMemory::UpdateValue() void CMeasureMemory::UpdateValue()
{ {
if (!m_Total) MEMORYSTATUSEX stat;
{ stat.dwLength = sizeof(MEMORYSTATUSEX);
MEMORYSTATUSEX stat; GlobalMemoryStatusEx(&stat);
stat.dwLength = sizeof(MEMORYSTATUSEX); m_MaxValue = (double)(__int64)(stat.ullTotalPageFile + stat.ullTotalPhys);
GlobalMemoryStatusEx(&stat);
if (m_Total)
{
m_Value = m_MaxValue;
}
else
{
m_Value = (double)(__int64)(stat.ullTotalPageFile + stat.ullTotalPhys - stat.ullAvailPageFile - stat.ullAvailPhys); m_Value = (double)(__int64)(stat.ullTotalPageFile + stat.ullTotalPhys - stat.ullAvailPageFile - stat.ullAvailPhys);
} }
} }
@ -68,8 +73,4 @@ void CMeasureMemory::ReadOptions(CConfigParser& parser, const WCHAR* section)
m_MaxValue = oldMaxValue; m_MaxValue = oldMaxValue;
m_Total = (1 == parser.ReadInt(section, L"Total", 0)); m_Total = (1 == parser.ReadInt(section, L"Total", 0));
if (m_Total)
{
m_Value = m_MaxValue;
}
} }

View File

@ -47,12 +47,17 @@ CMeasureVirtualMemory::~CMeasureVirtualMemory()
*/ */
void CMeasureVirtualMemory::UpdateValue() void CMeasureVirtualMemory::UpdateValue()
{ {
if (!m_Total) MEMORYSTATUSEX stat;
{ stat.dwLength = sizeof(MEMORYSTATUSEX);
MEMORYSTATUSEX stat; GlobalMemoryStatusEx(&stat);
stat.dwLength = sizeof(MEMORYSTATUSEX); m_MaxValue = (double)(__int64)stat.ullTotalPageFile;
GlobalMemoryStatusEx(&stat);
if (m_Total)
{
m_Value = m_MaxValue;
}
else
{
m_Value = (double)(__int64)(stat.ullTotalPageFile - stat.ullAvailPageFile); m_Value = (double)(__int64)(stat.ullTotalPageFile - stat.ullAvailPageFile);
} }
} }
@ -68,9 +73,5 @@ void CMeasureVirtualMemory::ReadOptions(CConfigParser& parser, const WCHAR* sect
m_MaxValue = oldMaxValue; m_MaxValue = oldMaxValue;
m_Total = (1 == parser.ReadInt(section, L"Total", 0)); m_Total = (1 == parser.ReadInt(section, L"Total", 0));
if (m_Total)
{
m_Value = m_MaxValue;
}
} }