Permalink
Browse files

Partially reverted cbee39e

  • Loading branch information...
1 parent 7e627cf commit 1c59a717fe7ffb36a294aa637e0e98a2253163ac @poiru poiru committed Aug 15, 2012
Showing with 20 additions and 18 deletions.
  1. +10 −9 Library/MeasureMemory.cpp
  2. +10 −9 Library/MeasureVirtualMemory.cpp
View
@@ -47,12 +47,17 @@ CMeasureMemory::~CMeasureMemory()
*/
void CMeasureMemory::UpdateValue()
{
- if (!m_Total)
- {
- MEMORYSTATUSEX stat;
- stat.dwLength = sizeof(MEMORYSTATUSEX);
- GlobalMemoryStatusEx(&stat);
+ MEMORYSTATUSEX stat;
+ stat.dwLength = sizeof(MEMORYSTATUSEX);
+ GlobalMemoryStatusEx(&stat);
+ m_MaxValue = (double)(__int64)(stat.ullTotalPageFile + stat.ullTotalPhys);
+ if (m_Total)
+ {
+ m_Value = m_MaxValue;
+ }
+ else
+ {
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_Total = (1 == parser.ReadInt(section, L"Total", 0));
- if (m_Total)
- {
- m_Value = m_MaxValue;
- }
}
@@ -47,12 +47,17 @@ CMeasureVirtualMemory::~CMeasureVirtualMemory()
*/
void CMeasureVirtualMemory::UpdateValue()
{
- if (!m_Total)
- {
- MEMORYSTATUSEX stat;
- stat.dwLength = sizeof(MEMORYSTATUSEX);
- GlobalMemoryStatusEx(&stat);
+ MEMORYSTATUSEX stat;
+ stat.dwLength = sizeof(MEMORYSTATUSEX);
+ GlobalMemoryStatusEx(&stat);
+ m_MaxValue = (double)(__int64)stat.ullTotalPageFile;
+ if (m_Total)
+ {
+ m_Value = m_MaxValue;
+ }
+ else
+ {
m_Value = (double)(__int64)(stat.ullTotalPageFile - stat.ullAvailPageFile);
}
}
@@ -68,9 +73,5 @@ void CMeasureVirtualMemory::ReadOptions(CConfigParser& parser, const WCHAR* sect
m_MaxValue = oldMaxValue;
m_Total = (1 == parser.ReadInt(section, L"Total", 0));
- if (m_Total)
- {
- m_Value = m_MaxValue;
- }
}

0 comments on commit 1c59a71

Please sign in to comment.