mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Retrieve memory size on apple.
This commit is contained in:
parent
9c966b6224
commit
34d24b16bb
@ -30,6 +30,8 @@
|
|||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <libproc.h>
|
# include <libproc.h>
|
||||||
|
# include <sys/types.h>
|
||||||
|
# include <sys/sysctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
@ -383,6 +385,11 @@ static const char* GetHostInfo()
|
|||||||
struct sysinfo sysInfo;
|
struct sysinfo sysInfo;
|
||||||
sysinfo( &sysInfo );
|
sysinfo( &sysInfo );
|
||||||
ptr += sprintf( ptr, "RAM: %lu MB\n", sysInfo.totalram / 1024 / 1024 );
|
ptr += sprintf( ptr, "RAM: %lu MB\n", sysInfo.totalram / 1024 / 1024 );
|
||||||
|
#elif defined __APPLE__
|
||||||
|
size_t memSize;
|
||||||
|
size_t sz = sizeof( memSize );
|
||||||
|
sysctlbyname( "hw.memsize", &memSize, &sz, nullptr, 0 );
|
||||||
|
ptr += sprintf( ptr, "RAM: %zu MB\n", memSize / 1024 / 1024 );
|
||||||
#else
|
#else
|
||||||
ptr += sprintf( ptr, "RAM: unknown\n" );
|
ptr += sprintf( ptr, "RAM: unknown\n" );
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user