Showing the changes to interface/src/scripting/PlatformInfoScriptingInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -7,6 +7,8 @@ · 6 unmodified lines | ||
| 7 | 7 | // |
| 8 | 8 | #include "PlatformInfoScriptingInterface.h" |
| 9 | 9 | |
| 10 | +# include <thread> | |
| 11 | + | |
| 10 | 12 | #ifdef Q_OS_WIN |
| 11 | 13 | #include <Windows.h> |
| 12 | 14 | #endif |
| @@ -34,6 +36,7 @@ QString PlatformInfoScriptingInterface::getCPUBrand() { · 21 unmodified lines | ||
| 34 | 36 | // Get the information associated with each extended ID. |
| 35 | 37 | __cpuid(CPUInfo, 0x80000000); |
| 36 | 38 | nExIds = CPUInfo[0]; |
| 39 | + | |
| 37 | 40 | for (i = 0x80000000; i <= nExIds; ++i) { |
| 38 | 41 | __cpuid(CPUInfo, i); |
| 39 | 42 | // Interpret CPU brand string |
| @@ -51,16 +54,18 @@ QString PlatformInfoScriptingInterface::getCPUBrand() { · 11 unmodified lines | ||
| 51 | 54 | return "NOT IMPLEMENTED"; |
| 52 | 55 | #endif |
| 53 | 56 | } |
| 54 | − ////MEMORYSTATUSEX statex; | |
| 55 | − ////statex.dwLength = sizeof (statex); | |
| 56 | − ////GlobalMemoryStatusEx(&statex); | |
| 57 | − ////cout << "Total System Memory: " << (statex.ullTotalPhys / 1024) / 1024 << "MB" << endl; | |
| 58 | 57 | |
| 59 | −int PlatformInfoScriptingInterface::getNumCores() { | |
| 58 | +unsigned int PlatformInfoScriptingInterface::getNumLogicalCores() { | |
| 59 | + | |
| 60 | + return std::thread::hardware_concurrency(); | |
| 61 | +} | |
| 62 | + | |
| 63 | +int PlatformInfoScriptingInterface::getTotalSystemMemoryMB() { | |
| 60 | 64 | #ifdef Q_OS_WIN |
| 61 | − SYSTEM_INFO sysInfo; | |
| 62 | − GetSystemInfo(&sysInfo); | |
| 63 | − return sysInfo.dwNumberOfProcessors; | |
| 65 | + MEMORYSTATUSEX statex; | |
| 66 | + statex.dwLength = sizeof (statex); | |
| 67 | + GlobalMemoryStatusEx(&statex); | |
| 68 | + return statex.ullTotalPhys / 1024 / 1024; | |
| 64 | 69 | #else |
| 65 | 70 | return -1; |
| 66 | 71 | #endif |