mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Can read number of logical processors
This commit is contained in:
parent
63ea300921
commit
3a9214747a
2 changed files with 25 additions and 8 deletions
|
@ -7,6 +7,10 @@
|
||||||
//
|
//
|
||||||
#include "PlatformInfoScriptingInterface.h"
|
#include "PlatformInfoScriptingInterface.h"
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
#include <Windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
PlatformInfoScriptingInterface* PlatformInfoScriptingInterface::getInstance() {
|
PlatformInfoScriptingInterface* PlatformInfoScriptingInterface::getInstance() {
|
||||||
static PlatformInfoScriptingInterface sharedInstance;
|
static PlatformInfoScriptingInterface sharedInstance;
|
||||||
return &sharedInstance;
|
return &sharedInstance;
|
||||||
|
@ -23,6 +27,7 @@ QString PlatformInfoScriptingInterface::getOperatingSystemType() {
|
||||||
}
|
}
|
||||||
|
|
||||||
QString PlatformInfoScriptingInterface::getCPUBrand() {
|
QString PlatformInfoScriptingInterface::getCPUBrand() {
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
int CPUInfo[4] = { -1 };
|
int CPUInfo[4] = { -1 };
|
||||||
unsigned nExIds, i = 0;
|
unsigned nExIds, i = 0;
|
||||||
char CPUBrandString[0x40];
|
char CPUBrandString[0x40];
|
||||||
|
@ -42,16 +47,21 @@ QString PlatformInfoScriptingInterface::getCPUBrand() {
|
||||||
}
|
}
|
||||||
|
|
||||||
return CPUBrandString;
|
return CPUBrandString;
|
||||||
//////string includes manufacturer, model and clockspeed
|
#else
|
||||||
////cout << "CPU Type: " << CPUBrandString << endl;
|
return "NOT IMPLEMENTED";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
////SYSTEM_INFO sysInfo;
|
|
||||||
////GetSystemInfo(&sysInfo);
|
|
||||||
////cout << "Number of Cores: " << sysInfo.dwNumberOfProcessors << endl;
|
|
||||||
|
|
||||||
////MEMORYSTATUSEX statex;
|
////MEMORYSTATUSEX statex;
|
||||||
////statex.dwLength = sizeof (statex);
|
////statex.dwLength = sizeof (statex);
|
||||||
////GlobalMemoryStatusEx(&statex);
|
////GlobalMemoryStatusEx(&statex);
|
||||||
////cout << "Total System Memory: " << (statex.ullTotalPhys / 1024) / 1024 << "MB" << endl;
|
////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
|
||||||
}
|
}
|
|
@ -32,6 +32,13 @@ public slots:
|
||||||
* @returns {string} brand of CPU
|
* @returns {string} brand of CPU
|
||||||
*/
|
*/
|
||||||
QString getCPUBrand();
|
QString getCPUBrand();
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* Returns the number of CPU cores
|
||||||
|
*function PlatformInfo.getNumCores()
|
||||||
|
* @returns {int} number of CPU cores
|
||||||
|
*/
|
||||||
|
int getNumCores();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_PlatformInfoScriptingInterface_h
|
#endif // hifi_PlatformInfoScriptingInterface_h
|
||||||
|
|
Loading…
Reference in a new issue