mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-08 14:42:09 +02:00
adding computer model to platform for macos
This commit is contained in:
parent
6595f86985
commit
9e00920884
5 changed files with 23 additions and 0 deletions
|
@ -16,6 +16,7 @@
|
|||
#ifdef Q_OS_MAC
|
||||
#include <unistd.h>
|
||||
#include <cpuid.h>
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
using namespace platform;
|
||||
|
@ -34,6 +35,7 @@ static void getCpuId( uint32_t* p, uint32_t ax )
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
void MACOSInstance::enumerateCpu() {
|
||||
json cpu = {};
|
||||
uint32_t cpuInfo[4]={0,0,0,0};
|
||||
|
@ -62,6 +64,16 @@ void MACOSInstance::enumerateCpu() {
|
|||
cpu[jsonKeys::cpuNumCores] = std::thread::hardware_concurrency();
|
||||
|
||||
_cpu.push_back(cpu);
|
||||
|
||||
|
||||
//get system name
|
||||
size_t len=0;
|
||||
sysctlbyname("hw.model",NULL, &len, NULL, 0);
|
||||
char* model = (char *) malloc(sizeof(char)*len+1);
|
||||
sysctlbyname("hw.model", model, &len, NULL,0);
|
||||
|
||||
_computerModel=std::string(model);
|
||||
free(model);
|
||||
}
|
||||
|
||||
void MACOSInstance::enumerateGpu() {
|
||||
|
@ -73,6 +85,7 @@ void MACOSInstance::enumerateGpu() {
|
|||
|
||||
_gpu.push_back(gpu);
|
||||
_display = ident->getOutput();
|
||||
|
||||
}
|
||||
|
||||
void MACOSInstance::enumerateMemory() {
|
||||
|
|
|
@ -77,3 +77,7 @@ int platform::getNumMemory() {
|
|||
json platform::getMemory(int index) {
|
||||
return _instance->getMemory(index);
|
||||
}
|
||||
|
||||
std::string platform::getComputerModel(){
|
||||
return _instance->getComputerModel();
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ json getDisplay(int index);
|
|||
int getNumMemory();
|
||||
json getMemory(int index);
|
||||
|
||||
std::string getComputerModel();
|
||||
} // namespace platform
|
||||
|
||||
#endif // hifi_platform_h
|
||||
|
|
|
@ -31,6 +31,8 @@ public:
|
|||
int getNumDisplay() { return (int)_display.size(); }
|
||||
json getDisplay(int index);
|
||||
|
||||
std::string getComputerModel(){return _computerModel;}
|
||||
|
||||
void virtual enumerateCpu()=0;
|
||||
void virtual enumerateMemory()=0;
|
||||
void virtual enumerateGpu()=0;
|
||||
|
@ -42,6 +44,7 @@ protected:
|
|||
std::vector<json> _memory;
|
||||
std::vector<json> _gpu;
|
||||
std::vector<json> _display;
|
||||
std::string _computerModel;
|
||||
};
|
||||
|
||||
} // namespace platform
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#elif defined(Q_OS_MAC)
|
||||
#include <OpenGL/OpenGL.h>
|
||||
#include<sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
#include <QtCore/QtGlobal>
|
||||
|
@ -56,6 +57,7 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
_dedicatedMemoryMB = bestVRAM;
|
||||
CGLDestroyRendererInfo(rendererInfo);
|
||||
|
||||
|
|
Loading…
Reference in a new issue