History

Can read number of logical processors

NissimHadar committed 7 years ago

Commit 3a921471 parent 63ea3002 files · +25 −8Browse files

Showing the changes to interface/src/scripting/PlatformInfoScriptingInterface.cpp (1 of 2 files). Show all

Unified · Split

interface/src/scripting/PlatformInfoScriptingInterface.cpp+18−8
@@ -7,6 +7,10 @@ · 6 unmodified lines
77 //
88 #include "PlatformInfoScriptingInterface.h"
99
10+#ifdef Q_OS_WIN
11+#include <Windows.h>
12+#endif
13+
1014 PlatformInfoScriptingInterface* PlatformInfoScriptingInterface::getInstance() {
1115 static PlatformInfoScriptingInterface sharedInstance;
1216 return &sharedInstance;
@@ -23,6 +27,7 @@ QString PlatformInfoScriptingInterface::getOperatingSystemType() { · 10 unmodified lines
2327 }
2428
2529 QString PlatformInfoScriptingInterface::getCPUBrand() {
30+#ifdef Q_OS_WIN
2631 int CPUInfo[4] = { -1 };
2732 unsigned nExIds, i = 0;
2833 char CPUBrandString[0x40];
@@ -42,16 +47,21 @@ QString PlatformInfoScriptingInterface::getCPUBrand() { · 13 unmodified lines
4247 }
4348
4449 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−
50+#else
51+ return "NOT IMPLEMENTED";
52+#endif
53+}
5354 ////MEMORYSTATUSEX statex;
5455 ////statex.dwLength = sizeof (statex);
5556 ////GlobalMemoryStatusEx(&statex);
5657 ////cout << "Total System Memory: " << (statex.ullTotalPhys / 1024) / 1024 << "MB" << endl;
58+
59+int PlatformInfoScriptingInterface::getNumCores() {
60+#ifdef Q_OS_WIN
61+ SYSTEM_INFO sysInfo;
62+ GetSystemInfo(&sysInfo);
63+ return sysInfo.dwNumberOfProcessors;
64+#else
65+ return -1;
66+#endif
5767 }