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
7//7//
8#include "PlatformInfoScriptingInterface.h"8#include "PlatformInfoScriptingInterface.h"
9 9
10#ifdef Q_OS_WIN
11#include <Windows.h>
12#endif
13
10PlatformInfoScriptingInterface* PlatformInfoScriptingInterface::getInstance() {14PlatformInfoScriptingInterface* PlatformInfoScriptingInterface::getInstance() {
11 static PlatformInfoScriptingInterface sharedInstance;15 static PlatformInfoScriptingInterface sharedInstance;
12 return &sharedInstance;16 return &sharedInstance;
@@ -23,6 +27,7 @@ QString PlatformInfoScriptingInterface::getOperatingSystemType() { · 10 unmodified lines
23}27}
24 28
25QString PlatformInfoScriptingInterface::getCPUBrand() {29QString PlatformInfoScriptingInterface::getCPUBrand() {
30#ifdef Q_OS_WIN
26 int CPUInfo[4] = { -1 };31 int CPUInfo[4] = { -1 };
27 unsigned nExIds, i = 0;32 unsigned nExIds, i = 0;
28 char CPUBrandString[0x40];33 char CPUBrandString[0x40];
@@ -42,16 +47,21 @@ QString PlatformInfoScriptingInterface::getCPUBrand() { · 13 unmodified lines
42 }47 }
43 48
44 return CPUBrandString;49 return CPUBrandString;
45 //////string includes manufacturer, model and clockspeed50#else
46 ////cout << "CPU Type: " << CPUBrandString << endl;51 return "NOT IMPLEMENTED";
47 52#endif
48 53}
49 ////SYSTEM_INFO sysInfo;
50 ////GetSystemInfo(&sysInfo);
51 ////cout << "Number of Cores: " << sysInfo.dwNumberOfProcessors << endl;
52
53 ////MEMORYSTATUSEX statex;54 ////MEMORYSTATUSEX statex;
54 ////statex.dwLength = sizeof (statex);55 ////statex.dwLength = sizeof (statex);
55 ////GlobalMemoryStatusEx(&statex);56 ////GlobalMemoryStatusEx(&statex);
56 ////cout << "Total System Memory: " << (statex.ullTotalPhys / 1024) / 1024 << "MB" << endl;57 ////cout << "Total System Memory: " << (statex.ullTotalPhys / 1024) / 1024 << "MB" << endl;
58
59int 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
57}67}