Skip to content

Commit d09625e

Browse files
committed
total device memory and processor count for linux
1 parent 489ebaa commit d09625e

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

source/gameanalytics/Platform/GALinux.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
#if IS_LINUX
44

5+
#include <execinfo.h>
6+
#include <sys/sysctl.h>
7+
#include <sys/utsname.h>
8+
#include <mach/mach.h>
9+
#include <sys/stat.h>
10+
#include <unistd.h>
11+
#include <sys/sysinfo.h>
12+
513
std::string gameanalytics::GAPlatformLinux::getOSVersion()
614
{
715
struct utsname info;
@@ -164,6 +172,34 @@ void gameanalytics::GAPlatformLinux::signalHandler(int sig, siginfo_t* info, voi
164172
}
165173
}
166174

175+
std::string gameanalytics::GAPlatformMacOS::getCpuModel() const
176+
{
177+
struct utsname systemInfo;
178+
uname(&systemInfo);
179+
180+
return systemInfo.machine;
181+
}
182+
183+
std::string gameanalytics::GAPlatformMacOS::getGpuModel() const
184+
{
185+
return UNKNOWN_VALUE;
186+
}
187+
188+
int gameanalytics::GAPlatformMacOS::getNumCpuCores() const
189+
{
190+
return (int)sysconf(_SC_NPROCESSORS_ONLN);
191+
}
192+
193+
int64_t gameanalytics::GAPlatformMacOS::getTotalDeviceMemory() const
194+
{
195+
struct sysinfo info = {};
196+
if(sysinfo(&info) == 0)
197+
{
198+
return utilities::convertBytesToMB(info.totalram);
199+
}
200+
201+
return 0;
202+
}
167203

168204
int64_t gameanalytics::GAPlatformLinux::getAppMemoryUsage() const
169205
{

0 commit comments

Comments
 (0)