blob: a81aba98a4c1e753fe4240b9967350113f23f1e9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
// Windows/System.h
#ifndef __WINDOWS_SYSTEM_H
#define __WINDOWS_SYSTEM_H
#include "..\Common\Types.h"
namespace NWindows {
namespace NSystem {
inline UInt32 GetNumberOfProcessors()
{
SYSTEM_INFO systemInfo;
GetSystemInfo(&systemInfo);
return (UInt32)systemInfo.dwNumberOfProcessors;
}
#ifndef _WIN64
typedef BOOL (WINAPI *GlobalMemoryStatusExP)(LPMEMORYSTATUSEX lpBuffer);
#endif
inline UInt64 GetRamSize()
{
MEMORYSTATUSEX stat;
stat.dwLength = sizeof(stat);
#ifdef _WIN64
if (!::GlobalMemoryStatusEx(&stat))
return 0;
return stat.ullTotalPhys;
#else
GlobalMemoryStatusExP globalMemoryStatusEx = (GlobalMemoryStatusExP)
::GetProcAddress(::GetModuleHandle(TEXT("kernel32.dll")),
"GlobalMemoryStatusEx");
if (globalMemoryStatusEx != 0)
if (globalMemoryStatusEx(&stat))
return stat.ullTotalPhys;
{
MEMORYSTATUS stat;
stat.dwLength = sizeof(stat);
GlobalMemoryStatus(&stat);
return stat.dwTotalPhys;
}
#endif
}
}}
#endif
|