diff --git a/interface/src/scripting/PlatformInfoScriptingInterface.cpp b/interface/src/scripting/PlatformInfoScriptingInterface.cpp index a6ef660b27..647262c547 100644 --- a/interface/src/scripting/PlatformInfoScriptingInterface.cpp +++ b/interface/src/scripting/PlatformInfoScriptingInterface.cpp @@ -7,6 +7,10 @@ // #include "PlatformInfoScriptingInterface.h" +#ifdef Q_OS_WIN +#include +#endif + PlatformInfoScriptingInterface* PlatformInfoScriptingInterface::getInstance() { static PlatformInfoScriptingInterface sharedInstance; return &sharedInstance; @@ -23,6 +27,7 @@ QString PlatformInfoScriptingInterface::getOperatingSystemType() { } QString PlatformInfoScriptingInterface::getCPUBrand() { +#ifdef Q_OS_WIN int CPUInfo[4] = { -1 }; unsigned nExIds, i = 0; char CPUBrandString[0x40]; @@ -42,16 +47,21 @@ QString PlatformInfoScriptingInterface::getCPUBrand() { } return CPUBrandString; - //////string includes manufacturer, model and clockspeed - ////cout << "CPU Type: " << CPUBrandString << endl; - - - ////SYSTEM_INFO sysInfo; - ////GetSystemInfo(&sysInfo); - ////cout << "Number of Cores: " << sysInfo.dwNumberOfProcessors << endl; - +#else + return "NOT IMPLEMENTED"; +#endif +} ////MEMORYSTATUSEX statex; ////statex.dwLength = sizeof (statex); ////GlobalMemoryStatusEx(&statex); ////cout << "Total System Memory: " << (statex.ullTotalPhys / 1024) / 1024 << "MB" << endl; + +int PlatformInfoScriptingInterface::getNumCores() { +#ifdef Q_OS_WIN + SYSTEM_INFO sysInfo; + GetSystemInfo(&sysInfo); + return sysInfo.dwNumberOfProcessors; +#else + return -1; +#endif } \ No newline at end of file diff --git a/interface/src/scripting/PlatformInfoScriptingInterface.h b/interface/src/scripting/PlatformInfoScriptingInterface.h index d8cba43884..47c8401455 100644 --- a/interface/src/scripting/PlatformInfoScriptingInterface.h +++ b/interface/src/scripting/PlatformInfoScriptingInterface.h @@ -32,6 +32,13 @@ public slots: * @returns {string} brand of CPU */ QString getCPUBrand(); + + /**jsdoc + * Returns the number of CPU cores + *function PlatformInfo.getNumCores() + * @returns {int} number of CPU cores + */ + int getNumCores(); }; #endif // hifi_PlatformInfoScriptingInterface_h