History

Updating the platform lib, implementing the first version of the profiler and exposing all these through the PlatformInfoScriptingInterface

Sam Gateau committed 7 years ago

Commit 5001a041 parent 3ce790b20 files · +646 −181Browse files

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

Unified · Split

interface/src/scripting/PlatformInfoScriptingInterface.cpp+63−0
@@ -10,6 +10,9 @@ · 9 unmodified lines
10#include <shared/GlobalAppProperties.h>10#include <shared/GlobalAppProperties.h>
11#include <thread>11#include <thread>
12 12
13#include <platform/Platform.h>
14#include <platform/Profiler.h>
15
13#ifdef Q_OS_WIN16#ifdef Q_OS_WIN
14#include <Windows.h>17#include <Windows.h>
15#elif defined Q_OS_MAC18#elif defined Q_OS_MAC
@@ -21,6 +24,17 @@ PlatformInfoScriptingInterface* PlatformInfoScriptingInterface::getInstance() { · 5 unmodified lines
21 return &sharedInstance;24 return &sharedInstance;
22}25}
23 26
27
28PlatformInfoScriptingInterface::PlatformInfoScriptingInterface() {
29 platform::create();
30 if (!platform::enumeratePlatform()) {
31 }
32}
33
34PlatformInfoScriptingInterface::~PlatformInfoScriptingInterface() {
35 platform::destroy();
36}
37
24QString PlatformInfoScriptingInterface::getOperatingSystemType() {38QString PlatformInfoScriptingInterface::getOperatingSystemType() {
25#ifdef Q_OS_WIN39#ifdef Q_OS_WIN
26 return "WINDOWS";40 return "WINDOWS";
@@ -149,3 +163,52 @@ bool PlatformInfoScriptingInterface::isStandalone() { · 122 unmodified lines
149 return qApp->property(hifi::properties::STANDALONE).toBool();163 return qApp->property(hifi::properties::STANDALONE).toBool();
150#endif164#endif
151}165}
166
167int PlatformInfoScriptingInterface::getNumCPUs() {
168 return platform::getNumCPUs();
169}
170
171QString PlatformInfoScriptingInterface::getCPU(int index) {
172 auto desc = platform::getCPU(index);
173 return QString(desc.dump().c_str());
174}
175
176int PlatformInfoScriptingInterface::getNumGPUs() {
177 return platform::getNumGPUs();
178}
179
180QString PlatformInfoScriptingInterface::getGPU(int index) {
181 auto desc = platform::getGPU(index);
182 return QString(desc.dump().c_str());
183}
184
185int PlatformInfoScriptingInterface::getNumDisplays() {
186 return platform::getNumDisplays();
187}
188
189QString PlatformInfoScriptingInterface::getDisplay(int index) {
190 auto desc = platform::getDisplay(index);
191 return QString(desc.dump().c_str());
192}
193
194QString PlatformInfoScriptingInterface::getMemory() {
195 auto desc = platform::getMemory(0);
196 return QString(desc.dump().c_str());
197}
198
199QString PlatformInfoScriptingInterface::getComputer() {
200 auto desc = platform::getComputer();
201 return QString(desc.dump().c_str());
202}
203
204
205PlatformInfoScriptingInterface::PlatformTier PlatformInfoScriptingInterface::getTierProfiled() {
206 return (PlatformInfoScriptingInterface::PlatformTier) platform::Profiler::profilePlatform();
207}
208
209QStringList PlatformInfoScriptingInterface::getPlatformTierNames() {
210 static const QStringList platformTierNames = { "UNKNWON", "LOW", "MID", "HIGH" };
211 return platformTierNames;
212}
213
214