Showing the changes to interface/src/scripting/PlatformInfoScriptingInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -21,3 +21,37 @@ QString PlatformInfoScriptingInterface::getOperatingSystemType() { · 20 unmodified lines | |||
| 21 | return "UNKNOWN"; | 21 | return "UNKNOWN"; |
| 22 | #endif | 22 | #endif |
| 23 | } | 23 | } |
| 24 | |||
| 25 | QString PlatformInfoScriptingInterface::getCPUBrand() { | ||
| 26 | int CPUInfo[4] = { -1 }; | ||
| 27 | unsigned nExIds, i = 0; | ||
| 28 | char CPUBrandString[0x40]; | ||
| 29 | // Get the information associated with each extended ID. | ||
| 30 | __cpuid(CPUInfo, 0x80000000); | ||
| 31 | nExIds = CPUInfo[0]; | ||
| 32 | for (i = 0x80000000; i <= nExIds; ++i) { | ||
| 33 | __cpuid(CPUInfo, i); | ||
| 34 | // Interpret CPU brand string | ||
| 35 | if (i == 0x80000002) { | ||
| 36 | memcpy(CPUBrandString, CPUInfo, sizeof(CPUInfo)); | ||
| 37 | } else if (i == 0x80000003) { | ||
| 38 | memcpy(CPUBrandString + 16, CPUInfo, sizeof(CPUInfo)); | ||
| 39 | } else if (i == 0x80000004) { | ||
| 40 | memcpy(CPUBrandString + 32, CPUInfo, sizeof(CPUInfo)); | ||
| 41 | } | ||
| 42 | } | ||
| 43 | |||
| 44 | return CPUBrandString; | ||
| 45 | //////string includes manufacturer, model and clockspeed | ||
| 46 | ////cout << "CPU Type: " << CPUBrandString << endl; | ||
| 47 | |||
| 48 | |||
| 49 | ////SYSTEM_INFO sysInfo; | ||
| 50 | ////GetSystemInfo(&sysInfo); | ||
| 51 | ////cout << "Number of Cores: " << sysInfo.dwNumberOfProcessors << endl; | ||
| 52 | |||
| 53 | ////MEMORYSTATUSEX statex; | ||
| 54 | ////statex.dwLength = sizeof (statex); | ||
| 55 | ////GlobalMemoryStatusEx(&statex); | ||
| 56 | ////cout << "Total System Memory: " << (statex.ullTotalPhys / 1024) / 1024 << "MB" << endl; | ||
| 57 | } | ||