mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-30 06:12:20 -06:00
Core: GetSystemMemoryStatus Win32, Linux
git-svn-id: svn://ultimatepp.org/upp/trunk@14568 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
f42d9f1e30
commit
adee7dee99
3 changed files with 15 additions and 16 deletions
|
|
@ -129,21 +129,22 @@ int CPU_Cores()
|
|||
|
||||
#endif
|
||||
|
||||
void GetSystemMemoryStatus(uint64& total, uint64& free)
|
||||
{
|
||||
#ifdef PLATFORM_WIN32
|
||||
bool IsDecentMachine()
|
||||
{
|
||||
if(!IsWin2K())
|
||||
return false;
|
||||
MEMORYSTATUS m;
|
||||
GlobalMemoryStatus(&m);
|
||||
return m.dwTotalPhys > 500 * 1024 * 1024;
|
||||
}
|
||||
MEMORYSTATUSEX m;
|
||||
GlobalMemoryStatusEx(&m);
|
||||
total = m.ullTotalPhys;
|
||||
free = m.ullAvailPhys;
|
||||
#elif defined(PLATFORM_LINUX)
|
||||
int pgsz = getpagesize();
|
||||
total = sysconf(_SC_PHYS_PAGES) * pgsz;
|
||||
free = sysconf(_SC_AVPHYS_PAGES) * pgsz;
|
||||
#else
|
||||
bool IsDecentMachine()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
total = 512*1024*1024;
|
||||
free = 16*1024*1024;
|
||||
#endif
|
||||
}
|
||||
|
||||
#define ENDIAN_SWAP { while(count--) { EndianSwap(*v++); } }
|
||||
|
||||
|
|
|
|||
|
|
@ -484,7 +484,7 @@ bool CpuAVX();
|
|||
|
||||
int CPU_Cores();
|
||||
|
||||
bool IsDecentMachine();
|
||||
void GetSystemMemoryStatus(uint64& total, uint64& free);
|
||||
|
||||
template <class T>
|
||||
inline void Swap(T& a, T& b) { T tmp = pick(a); a = pick(b); b = pick(tmp); }
|
||||
|
|
|
|||
|
|
@ -697,7 +697,6 @@ void Ctrl::SyncMoves()
|
|||
Ctrl& Ctrl::BackPaintHint()
|
||||
{
|
||||
GuiLock __;
|
||||
if(IsDecentMachine())
|
||||
BackPaint();
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -710,8 +709,7 @@ void Ctrl::GlobalBackPaint(bool b)
|
|||
|
||||
void Ctrl::GlobalBackPaintHint()
|
||||
{
|
||||
if(IsDecentMachine())
|
||||
GlobalBackPaint();
|
||||
GlobalBackPaint();
|
||||
}
|
||||
|
||||
void Ctrl::GlobalBackBuffer(bool b)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue